1 # $NetBSD: defs.mk.in,v 1.17 2023/06/03 09:10:13 lukem 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 ?= no 48 # Use library and includes by default. 49 COMPATLIB_NO_LIB ?= no 50 51 .if "${COMPATLIB_UNINSTALLED}" == "yes" 52 # The library lives in the .OBJDIR. 53 # 54 # Some include files live directly in the .OBJDIR, while others 55 # live in subdirectories of .OBJDIR/include. 56 # 57 COMPATOBJ:= ${.PARSEDIR} 58 COMPATLIBDIR= ${COMPATOBJ} 59 COMPATINCFLAGS= -I${COMPATOBJ} -I${COMPATOBJ}/include 60 .else 61 # The library lives in TOOLDIR/lib. 62 # 63 # All include files live in TOOLDIR/include/comnpat, and its subdirectories. 64 # 65 COMPATLIBDIR= ${TOOLDIR}/lib 66 COMPATINCFLAGS= -I${TOOLDIR}/include/compat 67 .endif 68 69 HOSTEXEEXT= @EXEEXT@ 70 HOST_BSHELL= @BSHELL@ 71 72 BUILD_OSTYPE!= uname -s 73 74 HOST_CFLAGS+= @CC_NO_CPP_PRECOMP@ 75 76 # Override HOST_CC support for <bsd.own.mk> CC_* warnings 77 # 78 CC_WNO_ADDRESS_OF_PACKED_MEMBER=@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ @CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@ 79 CC_WNO_CAST_FUNCTION_TYPE=@CC_WNO_CAST_FUNCTION_TYPE@ 80 CC_WNO_FORMAT_OVERFLOW=@CC_WNO_FORMAT_OVERFLOW@ 81 CC_WNO_FORMAT_TRUNCATION=@CC_WNO_FORMAT_TRUNCATION@ 82 CC_WNO_IMPLICIT_FALLTHROUGH=@CC_WNO_IMPLICIT_FALLTHROUGH@ 83 CC_WNO_MAYBE_UNINITIALIZED=@CC_WNO_MAYBE_UNINITIALIZED@ 84 CC_WNO_RETURN_LOCAL_ADDR=@CC_WNO_RETURN_LOCAL_ADDR@ 85 CC_WNO_STRINGOP_OVERFLOW=@CC_WNO_STRINGOP_OVERFLOW@ 86 CC_WNO_STRINGOP_TRUNCATION=@CC_WNO_STRINGOP_TRUNCATION@ 87 88 HOST_CPPFLAGS+= ${COMPATINCFLAGS} -I${NETBSDSRCDIR}/tools/compat \ 89 -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 90 91 .if "${COMPATLIB_NO_LIB}" != "yes" 92 DPADD+= ${COMPATLIBDIR}/libnbcompat.a 93 LDADD+= -L${COMPATLIBDIR} -lnbcompat @LIBS@ 94 .endif # ! COMPATLIB_NO_LIB 95