1 # $NetBSD: Makefile.inc,v 1.19 2002/11/02 07:49:57 perry Exp $
3 # Configuration variables (default values are below):
5 # S must be set to the top of the 'sys' tree.
7 # may be set to the location of the directory where library
8 # objects are to be built. Defaults to ${.OBJDIR}/lib/compat.
10 # may be set to 'obj' to build a object from the library's
11 # object files. (Otherwise, a library will be built.)
12 # Defaults to 'library'.
14 # Miscellaneous flags to be passed to the library's Makefile when
15 # building. See library's Makefile for more details about
16 # supported flags and their default values.
19 COMPATDST?= ${.OBJDIR}/lib/compat
21 COMPATDOTDIR?= ../../.
23 COMPATDIR= ${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common
24 .if (${COMPAT_AS} == "obj")
25 COMPATLIB= ${COMPATDST}/libcompat.o
26 COMPATLIB_PROF= ${COMPATDST}/libcompat.po
28 COMPATLIB= ${COMPATDST}/libcompat.a
29 COMPATLIB_PROF= ${COMPATDST}/libcompat_p.a
32 LIBCOMPATLNBN= llib-lcompat.ln
33 COMPATLIBLN= ${COMPATDST}/${LIBCOMPATLNBN}
36 cd ${COMPATDST} && ${MAKE} -f ${COMPATDIR:Q}/Makefile \
37 COMPATDIR=${COMPATDIR:Q} \
38 CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
39 AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
40 AR=${AR:Q} NM=${NM:Q} \
44 LD=${LD:Q} LDFLAGS=${LDFLAGS:Q} \
46 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
47 COMPATCPPFLAGS=${CPPFLAGS:S@^-I.@-I${COMPATDOTDIR}@g:Q} \
48 LINTFLAGS=${KERNLINTFLAGS:Q} \
49 ${COMPATMISCMAKEFLAGS}
51 ${COMPATLIB}: .NOTMAIN .MAKE __always_make_compatlib
52 @echo making sure the compat library is up to date...
53 .if (${COMPAT_AS} == "library")
54 @${COMPATMAKE} libcompat.a
56 @${COMPATMAKE} libcompat.o
59 ${COMPATLIB_PROF}: .NOTMAIN .MAKE __always_make_compatlib
60 @echo making sure the profiled compat library is up to date...
61 .if (${COMPAT_AS} == "library")
62 @${COMPATMAKE} libcompat_p.a
64 @${COMPATMAKE} libcompat.po
67 ${COMPATLIBLN}: .NOTMAIN .MAKE __always_make_compatlib
68 @echo making sure the compat lint library is up to date...
69 @${COMPATMAKE} ${LIBCOMPATLNBN}
71 clean: .NOTMAIN cleancompatlib
72 cleancompatlib: .NOTMAIN .MAKE __always_make_compatlib
73 @echo cleaning the compat library objects
76 cleandir distclean: .NOTMAIN cleandircompatlib
77 cleandircompatlib: .NOTMAIN .MAKE __always_make_compatlib
78 @echo cleandiring the compat library objects
79 @${COMPATMAKE} cleandir
81 depend: .NOTMAIN dependcompatlib
82 dependcompatlib: .NOTMAIN .MAKE __always_make_compatlib
83 @echo depending the compat library objects
86 __always_make_compatlib: .NOTMAIN
87 @mkdir -p ${COMPATDST}
89 .PHONY: __always_make_compatlib
90 .PHONY: cleancompatlib cleandircompatlib dependcompatlib