clean up substantially. Transform clean, depend, cleandir targets from ::

to :, so they can be used e.g. with <bsd.prog.mk>.  Standardize variable
names used to configure kernel libraries.

Variables used by these Makefile.inc's are:

S               must be set to the top of the 'sys' tree.
${LIB}DST       may be set to the location of the directory where library
                objects are to be built.  Defaults to ${.OBJDIR}/lib/${lib}.
${LIB}_AS       may be set to 'obj' to build a object from the library's
                object files.  (Otherwise, a library will be built.)
                Defaults to 'library'.
${LIB}MISCMAKEFLAGS
                Miscellaneous flags to be passed to the library's Makefile when
                building.  See library's Makefile for more details about
                supported flags and their default values.

(where LIB is COMPAT, and lib is compat, in this case.)
This commit is contained in:
cgd 1997-01-23 22:58:26 +00:00
parent 5f36c62a33
commit 78d5e815bf

View File

@ -1,34 +1,72 @@
# $NetBSD: Makefile.inc,v 1.11 1996/12/26 21:30:59 christos Exp $
# $NetBSD: Makefile.inc,v 1.12 1997/01/23 22:58:26 cgd Exp $
#
# NOTE: $S must correspond to the top of the 'sys' tree
# Configuration variables (default values are below):
#
# S must be set to the top of the 'sys' tree.
# COMPATDST
# may be set to the location of the directory where library
# objects are to be built. Defaults to ${.OBJDIR}/lib/compat.
# COMPAT_AS
# may be set to 'obj' to build a object from the library's
# object files. (Otherwise, a library will be built.)
# Defaults to 'library'.
# COMPATMISCMAKEFLAGS
# Miscellaneous flags to be passed to the library's Makefile when
# building. See library's Makefile for more details about
# supported flags and their default values.
COMPATDIR= $S/compat/common
# Default values:
COMPATDST?= ${.OBJDIR}/lib/compat
COMPAT_AS?= library
COMPATDST?= ${.OBJDIR}/lib/compat
COMPATLIB= ${COMPATDST}/libcompat.a
COMPATDIR= $S/compat/common
.if (${COMPAT_AS} == "obj")
COMPATLIB= ${COMPATDST}/libcompat.o
COMPATLIB_PROF= ${COMPATDST}/libcompat.po
.else
COMPATLIB= ${COMPATDST}/libcompat.a
COMPATLIB_PROF= ${COMPATDST}/libcompat_p.a
.endif
COMPATMAKE= \
cd ${COMPATDIR} && MAKEOBJDIR=${COMPATDST} ${MAKE} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
LD=${LD:Q} \
COMPATCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q}
AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
LD=${LD:Q} STRIP=${STRIP:Q} \
MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
COMPATCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \
${COMPATMISCMAKEFLAGS}
${COMPATLIB}: .NOTMAIN __always_make_compatlib
@echo making sure the compat library is up to date...
.if (${COMPAT_AS} == "library")
@${COMPATMAKE} libcompat.a
.else
@${COMPATMAKE} libcompat.o
.endif
${COMPATLIB_PROF}: .NOTMAIN __always_make_compatlib
@echo making sure the profiled compat library is up to date...
.if (${COMPAT_AS} == "library")
@${COMPATMAKE} libcompat_p.a
.else
@${COMPATMAKE} libcompat.po
.endif
clean:: .NOTMAIN __always_make_compatlib
clean: .NOTMAIN cleancompatlib
cleancompatlib: .NOTMAIN __always_make_compatlib
@echo cleaning the compat library objects
@${COMPATMAKE} clean
depend:: .NOTMAIN __always_make_compatlib
cleandir: .NOTMAIN cleandircompatlib
cleandircompatlib: .NOTMAIN __always_make_compatlib
@echo cleandiring the compat library objects
@${COMPATMAKE} cleandir
depend: .NOTMAIN dependcompatlib
dependcompatlib: .NOTMAIN __always_make_compatlib
@echo depending the compat library objects
@${COMPATMAKE} depend
__always_make_compatlib: .NOTMAIN
__always_make_compatlib: .NOTMAIN
@mkdir -p ${COMPATDST}