Home | History | Annotate | Line # | Download | only in libkern
Makefile.inc revision 1.40.94.1
      1 #	$NetBSD: Makefile.inc,v 1.40.94.1 2009/08/21 18:01:18 matt Exp $
      2 #
      3 #	Configuration variables (default values are below):
      4 #
      5 #	S	must be set to the top of the 'sys' tree.
      6 #	KERNDST	may be set to the location of the directory where library
      7 #		objects are to be built.  Defaults to ${.OBJDIR}/lib/kern.
      8 #	KERN_AS	may be set to 'obj' to build a object from the library's
      9 #		object files.  (Otherwise, a library will be built.)
     10 #		Defaults to 'library'.
     11 #	KERNMISCCPPFLAGS
     12 #		Miscellaneous cpp flags to be passed to the library's Makefile
     13 #		when building.
     14 #	KERNMISCMAKEFLAGS
     15 #		Miscellaneous flags to be passed to the library's Makefile when
     16 #		building.  See library's Makefile for more details about
     17 #		supported flags and their default values.
     18 
     19 # Default values:
     20 KERNDST?=	${.OBJDIR}/lib/kern
     21 KERN_AS?=	library
     22 KERNDOTDIR?= ../../.
     23 
     24 KERNDIR=	${S:S@^.@${KERNDOTDIR}@:Q}/lib/libkern
     25 .if (${KERN_AS} == "obj")
     26 KERNLIB=	${KERNDST}/libkern.o
     27 KERNLIB_PROF=	${KERNDST}/libkern.po
     28 .else
     29 KERNLIB=	${KERNDST}/libkern.a
     30 KERNLIB_PROF=	${KERNDST}/libkern_p.a
     31 .endif
     32 
     33 LIBKERNLNBN=	llib-lkern.ln
     34 KERNLIBLN=	${KERNDST}/${LIBKERNLNBN}
     35 
     36 KERNMAKE= \
     37 	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:Q}/Makefile \
     38 	    KERNDIR=${KERNDIR:Q} \
     39 	    CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
     40 	    AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
     41 	    LORDER=${LORDER:Q} \
     42 	    TSORT=${TSORT:Q} \
     43 	    LD=${LD:Q} LDFLAGS=${LDFLAGS:Q} \
     44 	    STRIP=${STRIP:Q} \
     45 	    AR=${AR:Q} NM=${NM:Q} \
     46 	    RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
     47 	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
     48 	    KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:Q} \
     49 	    KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:Q} \
     50 	    LINTFLAGS=${KERNLINTFLAGS:Q} \
     51 	    ${KERNMISCMAKEFLAGS}
     52 
     53 ${KERNLIB}:		.NOTMAIN .MAKE __always_make_kernlib
     54 	@echo making sure the kern library is up to date...
     55 .if (${KERN_AS} == "library")
     56 	@${KERNMAKE} libkern.a
     57 .else
     58 	@${KERNMAKE} libkern.o
     59 .endif
     60 
     61 ${KERNLIB_PROF}:	.NOTMAIN .MAKE __always_make_kernlib
     62 	@echo making sure the profiled kern library is up to date...
     63 .if (${KERN_AS} == "library")
     64 	@${KERNMAKE} libkern_p.a
     65 .else
     66 	@${KERNMAKE} libkern.po
     67 .endif
     68 
     69 ${KERNLIBLN}:		.NOTMAIN .MAKE __always_make_kernlib
     70 	@echo making sure the kern lint library is up to date...
     71 	@${KERNMAKE} ${LIBKERNLNBN}
     72 
     73 clean:			.NOTMAIN cleankernlib
     74 cleankernlib:		.NOTMAIN
     75 	@echo cleaning the kern library objects
     76 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} clean; fi
     77 
     78 cleandir distclean:	.NOTMAIN cleandirkernlib
     79 cleandirkernlib:	.NOTMAIN
     80 	@echo cleandiring the kern library objects
     81 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} cleandir; fi
     82 
     83 dependall depend:	.NOTMAIN dependkernlib
     84 dependkernlib:		.NOTMAIN .MAKE __always_make_kernlib
     85 	@echo depending the kern library objects
     86 	@${KERNMAKE} depend
     87 
     88 __always_make_kernlib:	.NOTMAIN
     89 	@(mkdir -p ${KERNDST})
     90 
     91 .PHONY: __always_make_kernlib
     92 .PHONY: cleankernlib cleandirkernlib dependkernlib
     93 
     94 .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
     95