defs.mk.in revision 1.11 1 # $NetBSD: defs.mk.in,v 1.11 2012/12/02 12:37:08 apb Exp $
2 #
3 # Makefile fragment for building with libnbcompat and associated
4 # include files. It can also be used for building just with
5 # the include files, without the library.
6 #
7 # This can be used when the library and include files have been installed
8 # into TOOLDIR (by "make install" in the src/tools/compat directory),
9 # or when they have not been installed into TOOLDIR but reside
10 # in the .OBJDIR associated with src/tools/compat.
11 #
12 # Variables:
13 #
14 # COMPATLIB_UNINSTALLED:
15 # If "yes", then use the files from the .OBJDIR of
16 # NETBSDSRCDIR/tools/compat. Otherwise, use the files
17 # from TOOLDIR.
18 #
19 # COMPATLIB_NO_LIB:
20 # If "yes" then do not use the library (but still use
21 # the include files).
22 #
23 # Examples:
24 #
25 # * Use uninstalled copy of libnbcompat and associated *.h files:
26 #
27 # COMPATLIB_UNINSTALLED= yes
28 # COMPATOBJ!= cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
29 # .-include "${COMPATOBJ}/defs.mk"
30 #
31 # * Use TOOLDIR copy of libnbcompat and associated *.h files:
32 #
33 # .-include "${TOOLDIR}/share/compat/defs.mk"
34 #
35 # * Use TOOLDIR copy of compat *.h files, but do not use libnbcompat.a:
36 #
37 # COMPATLIB_NO_LIB= yes
38 # .-include "${TOOLDIR}/share/compat/defs.mk"
39 #
40 # The use of ".-include" instead of ".include" above is because it's
41 # expected that the file might not exist during "make obj" or "make clean".
42 #
43
44 .include <bsd.own.mk>
45
46 # Use the installed (TOOLDIR) version of the library and headers by default
47 COMPATLIB_UNINSTALLED ?= yes # will be changed to "no" as soon as callers
48 # have been adjusted.
49 # Use library and includes by default.
50 COMPATLIB_NO_LIB ?= no
51
52 .if "${COMPATLIB_UNINSTALLED}" == "yes"
53 # The library lives in the .OBJDIR.
54 #
55 # Some include files live directly in the .OBJDIR, while others
56 # live in subdirectories of .OBJDIR/include.
57 #
58 COMPATOBJ:= ${.PARSEDIR}
59 COMPATLIBDIR= ${COMPATOBJ}
60 COMPATINCFLAGS= -I${COMPATOBJ} -I${COMPATOBJ}/include
61 .else
62 # The library lives in TOOLDIR/lib.
63 #
64 # All include files live in TOOLDIR/include/comnpat, and its subdirectories.
65 #
66 COMPATLIBDIR= ${TOOLDIR}/lib
67 COMPATINCFLAGS= -I${TOOLDIR}/include/compat
68 .endif
69
70 HOSTEXEEXT= @EXEEXT@
71 HOST_BSHELL= @BSHELL@
72
73 BUILD_OSTYPE!= uname -s
74
75 # Disable use of pre-compiled headers on Darwin.
76 .if ${BUILD_OSTYPE} == "Darwin"
77 HOST_CPPFLAGS+= -no-cpp-precomp
78 .endif
79
80 HOST_CPPFLAGS+= ${COMPATINCFLAGS} -I${NETBSDSRCDIR}/tools/compat \
81 -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
82
83 .if "${COMPATLIB_NO_LIB}" != "yes"
84 DPADD+= ${COMPATLIBDIR}/libnbcompat.a
85 LDADD+= -L${COMPATLIBDIR} -lnbcompat @LIBS@
86 .endif # ! COMPATLIB_NO_LIB
87
88 HAVE_PTHREAD_H= @HAVE_PTHREAD_H@
89