xref: /netbsd-src/external/cddl/osnet/dist/tools/ctf/common/ctf_headers.h (revision a864dc36a152ff257761882aea174a236eb36c81)
1*a864dc36Sdarran /*
2*a864dc36Sdarran  * CDDL HEADER START
3*a864dc36Sdarran  *
4*a864dc36Sdarran  * The contents of this file are subject to the terms of the
5*a864dc36Sdarran  * Common Development and Distribution License, Version 1.0 only
6*a864dc36Sdarran  * (the "License").  You may not use this file except in compliance
7*a864dc36Sdarran  * with the License.
8*a864dc36Sdarran  *
9*a864dc36Sdarran  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*a864dc36Sdarran  * or http://www.opensolaris.org/os/licensing.
11*a864dc36Sdarran  * See the License for the specific language governing permissions
12*a864dc36Sdarran  * and limitations under the License.
13*a864dc36Sdarran  *
14*a864dc36Sdarran  * When distributing Covered Code, include this CDDL HEADER in each
15*a864dc36Sdarran  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*a864dc36Sdarran  * If applicable, add the following below this CDDL HEADER, with the
17*a864dc36Sdarran  * fields enclosed by brackets "[]" replaced with your own identifying
18*a864dc36Sdarran  * information: Portions Copyright [yyyy] [name of copyright owner]
19*a864dc36Sdarran  *
20*a864dc36Sdarran  * CDDL HEADER END
21*a864dc36Sdarran  */
22*a864dc36Sdarran /*
23*a864dc36Sdarran  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*a864dc36Sdarran  * Use is subject to license terms.
25*a864dc36Sdarran  */
26*a864dc36Sdarran 
27*a864dc36Sdarran #ifndef _CTF_HEADERS_H
28*a864dc36Sdarran #define	_CTF_HEADERS_H
29*a864dc36Sdarran 
30*a864dc36Sdarran #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*a864dc36Sdarran 
32*a864dc36Sdarran /*
33*a864dc36Sdarran  * Because the ON tools are executed on the system where they are built,
34*a864dc36Sdarran  * the tools need to include the headers installed on the build system,
35*a864dc36Sdarran  * rather than those in the ON source tree. However, some of the headers
36*a864dc36Sdarran  * required by the tools are part of the ON source tree, but not delivered
37*a864dc36Sdarran  * as part of Solaris.  These include the following:
38*a864dc36Sdarran  *
39*a864dc36Sdarran  * $(SRC)/lib/libctf/common/libctf.h
40*a864dc36Sdarran  * $(SRC)/uts/common/sys/ctf_api.h
41*a864dc36Sdarran  * $(SRC)/uts/common/sys/ctf.h
42*a864dc36Sdarran  *
43*a864dc36Sdarran  * These headers get installed in the proto area in the build environment
44*a864dc36Sdarran  * under $(ROOT)/usr/include and $(ROOT)/usr/include/sys. Though these
45*a864dc36Sdarran  * headers are not part of the release, in releases including and prior to
46*a864dc36Sdarran  * Solaris 9, they did get installed on the build system via bfu. Therefore,
47*a864dc36Sdarran  * we can not simply force the order of inclusion with -I/usr/include first
48*a864dc36Sdarran  * in Makefile.ctf because we might actually get downlevel versions of the
49*a864dc36Sdarran  * ctf headers. Depending on the order of the -I includes, we can also have
50*a864dc36Sdarran  * a problem with mismatched headers when building the ctf tools with some
51*a864dc36Sdarran  * headers getting pulled in from /usr/include and others from
52*a864dc36Sdarran  * $(SRC)/uts/common/sys.
53*a864dc36Sdarran  *
54*a864dc36Sdarran  * To address the problem, we have done two things:
55*a864dc36Sdarran  * 1) Created this header with a specific order of inclusion for the
56*a864dc36Sdarran  *    ctf headers.  Because the <libctf.h> header includes <sys/ctf_api.h>
57*a864dc36Sdarran  *    which in turn includes <sys/ctf.h> we need to include these in
58*a864dc36Sdarran  *    reverse order to guarantee that we get the correct versions of
59*a864dc36Sdarran  *    the headers.
60*a864dc36Sdarran  * 2) In $(SRC)/tools/ctf/Makefile.ctf, we order the -I includes such
61*a864dc36Sdarran  *    that we first search the directories where the ctf headers
62*a864dc36Sdarran  *    live, followed by /usr/include, followed by $(SRC)/uts/common.
63*a864dc36Sdarran  *    This last -I include is needed in order to prevent a build failure
64*a864dc36Sdarran  *    when <sys/ctf_api.h> is included via a nested #include rather than
65*a864dc36Sdarran  *    an explicit path #include.
66*a864dc36Sdarran  */
67*a864dc36Sdarran 
68*a864dc36Sdarran #include <uts/common/sys/ctf.h>
69*a864dc36Sdarran #include <uts/common/sys/ctf_api.h>
70*a864dc36Sdarran #include <lib/libctf/common/libctf.h>
71*a864dc36Sdarran 
72*a864dc36Sdarran #endif /* _CTF_HEADERS_H */
73