Module Name:    src
Committed By:   apb
Date:           Sun Dec  2 12:37:08 UTC 2012

Modified Files:
        src/tools/compat: defs.mk.in

Log Message:
Add two variables to tools/compat/defs.mk.in:

COMPATLIB_UNINSTALLED:
                If "yes", then use the files from the .OBJDIR of
                NETBSDSRCDIR/tools/compat.  Otherwise, use the files
                from TOOLDIR.

COMPATLIB_NO_LIB:
                If "yes" then do not use the library (but still use
                the include files).

COMPATLIB_UNINSTALLED defaults to "yes" for now, but this will soon be
changed to "no.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tools/compat/defs.mk.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/compat/defs.mk.in
diff -u src/tools/compat/defs.mk.in:1.10 src/tools/compat/defs.mk.in:1.11
--- src/tools/compat/defs.mk.in:1.10	Sun Aug 14 20:22:42 2011
+++ src/tools/compat/defs.mk.in	Sun Dec  2 12:37:08 2012
@@ -1,8 +1,73 @@
-#	$NetBSD: defs.mk.in,v 1.10 2011/08/14 20:22:42 apb Exp $
-
+#	$NetBSD: defs.mk.in,v 1.11 2012/12/02 12:37:08 apb Exp $
+#
+# Makefile fragment for building with libnbcompat and associated
+# include files.  It can also be used for building just with
+# the include files, without the library.
+#
+# This can be used when the library and include files have been installed
+# into TOOLDIR (by "make install" in the src/tools/compat directory),
+# or when they have not been installed into TOOLDIR but reside
+# in the .OBJDIR associated with src/tools/compat.
+#
+# Variables:
+#
+# COMPATLIB_UNINSTALLED:
+#		If "yes", then use the files from the .OBJDIR of
+#		NETBSDSRCDIR/tools/compat.  Otherwise, use the files
+#		from TOOLDIR.
+#
+# COMPATLIB_NO_LIB:
+#		If "yes" then do not use the library (but still use
+#		the include files).
+#
+# Examples:
+#
+# * Use uninstalled copy of libnbcompat and associated *.h files:
+#
+#	COMPATLIB_UNINSTALLED= yes
+#	COMPATOBJ!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
+#	.-include	"${COMPATOBJ}/defs.mk"
+#
+# * Use TOOLDIR copy of libnbcompat and associated *.h files:
+#
+#	.-include	"${TOOLDIR}/share/compat/defs.mk"
+#
+# * Use TOOLDIR copy of compat *.h files, but do not use libnbcompat.a:
+#
+#	COMPATLIB_NO_LIB= yes
+#	.-include	"${TOOLDIR}/share/compat/defs.mk"
+#
+# The use of ".-include" instead of ".include" above is because it's
+# expected that the file might not exist during "make obj" or "make clean".
+#
+
+.include <bsd.own.mk>
+
+# Use the installed (TOOLDIR) version of the library and headers by default
+COMPATLIB_UNINSTALLED ?= yes	# will be changed to "no" as soon as callers
+				# have been adjusted.
+# Use library and includes by default.
+COMPATLIB_NO_LIB ?= no
+
+.if "${COMPATLIB_UNINSTALLED}" == "yes"
+# The library lives in the .OBJDIR.
+#
+# Some include files live directly in the .OBJDIR, while others
+# live in subdirectories of .OBJDIR/include.
+#
 COMPATOBJ:=	${.PARSEDIR}
-HOSTEXEEXT=	@EXEEXT@
+COMPATLIBDIR=	${COMPATOBJ}
+COMPATINCFLAGS=	-I${COMPATOBJ} -I${COMPATOBJ}/include
+.else
+# The library lives in TOOLDIR/lib.
+#
+# All include files live in TOOLDIR/include/comnpat, and its subdirectories.
+#
+COMPATLIBDIR=	${TOOLDIR}/lib
+COMPATINCFLAGS=	-I${TOOLDIR}/include/compat
+.endif
 
+HOSTEXEEXT=	@EXEEXT@
 HOST_BSHELL=	@BSHELL@
 
 BUILD_OSTYPE!=  uname -s
@@ -12,11 +77,12 @@ BUILD_OSTYPE!=  uname -s
 HOST_CPPFLAGS+=	-no-cpp-precomp
 .endif
 
-HOST_CPPFLAGS+=	-I${COMPATOBJ} -I${COMPATOBJ}/include \
-		-I${.CURDIR}/../compat -DHAVE_NBTOOL_CONFIG_H=1 \
-		-D_FILE_OFFSET_BITS=64
+HOST_CPPFLAGS+=	${COMPATINCFLAGS} -I${NETBSDSRCDIR}/tools/compat \
+		-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
 
-DPADD+=		${COMPATOBJ}/libnbcompat.a
-LDADD+=		-L${COMPATOBJ} -lnbcompat @LIBS@
+.if "${COMPATLIB_NO_LIB}" != "yes"
+DPADD+=		${COMPATLIBDIR}/libnbcompat.a
+LDADD+=		-L${COMPATLIBDIR} -lnbcompat @LIBS@
+.endif # ! COMPATLIB_NO_LIB
 
 HAVE_PTHREAD_H=	@HAVE_PTHREAD_H@

Reply via email to