Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools/compat Add two variables to tools/compat/defs.mk.in:



details:   https://anonhg.NetBSD.org/src/rev/940a48dd7342
branches:  trunk
changeset: 783042:940a48dd7342
user:      apb <apb%NetBSD.org@localhost>
date:      Sun Dec 02 12:37:08 2012 +0000

description:
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.

diffstat:

 tools/compat/defs.mk.in |  80 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 73 insertions(+), 7 deletions(-)

diffs (97 lines):

diff -r c11cb248ee63 -r 940a48dd7342 tools/compat/defs.mk.in
--- a/tools/compat/defs.mk.in   Sun Dec 02 12:34:51 2012 +0000
+++ b/tools/compat/defs.mk.in   Sun Dec 02 12:37:08 2012 +0000
@@ -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}
+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 @@
 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@



Home | Main Index | Thread Index | Old Index