NetBSD/sys/lib/libkern/Makefile.inc
cgd 3ca5f41d59 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 KERN, SA, or Z, and lib is kern, sa, or z, depending on which
library's Makefile.inc is being discussed.)
1997-01-23 22:29:07 +00:00

71 lines
2.0 KiB
Makefile

# $NetBSD: Makefile.inc,v 1.24 1997/01/23 22:29:07 cgd Exp $
#
# Configuration variables (default values are below):
#
# S must be set to the top of the 'sys' tree.
# KERNDST may be set to the location of the directory where library
# objects are to be built. Defaults to ${.OBJDIR}/lib/kern.
# KERN_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'.
# KERNMISCMAKEFLAGS
# 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.
# Default values:
KERNDST?= ${.OBJDIR}/lib/kern
KERN_AS?= obj
KERNDIR= $S/lib/libkern
.if (${KERN_AS} == "obj")
KERNLIB= ${KERNDST}/libkern.o
KERNLIB_PROF= ${KERNDST}/libkern.po
.else
KERNLIB= ${KERNDST}/libkern.a
KERNLIB_PROF= ${KERNDST}/libkern_p.a
.endif
KERNMAKE= \
cd ${KERNDIR} && MAKEOBJDIR=${KERNDST} ${MAKE} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
LD=${LD:Q} STRIP=${STRIP:Q} \
MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \
${KERNMISCMAKEFLAGS}
${KERNLIB}: .NOTMAIN __always_make_kernlib
@echo making sure the kern library is up to date...
.if (${KERN_AS} == "library")
@${KERNMAKE} libkern.a
.else
@${KERNMAKE} libkern.o
.endif
${KERNLIB_PROF}: .NOTMAIN __always_make_kernlib
@echo making sure the profiled kern library is up to date...
.if (${KERN_AS} == "library")
@${KERNMAKE} libkern_p.a
.else
@${KERNMAKE} libkern.po
.endif
clean: .NOTMAIN cleankernlib
cleankernlib: .NOTMAIN __always_make_kernlib
@echo cleaning the kern library objects
@${KERNMAKE} clean
cleandir: .NOTMAIN cleandirkernlib
cleandirkernlib: .NOTMAIN __always_make_kernlib
@echo cleandiring the kern library objects
@${KERNMAKE} cleandir
depend: .NOTMAIN dependkernlib
dependkernlib: .NOTMAIN __always_make_kernlib
@echo depending the kern library objects
@${KERNMAKE} depend
__always_make_kernlib: .NOTMAIN
@mkdir -p ${KERNDST}