Home | History | Annotate | Line # | Download | only in libkern
Makefile.inc revision 1.32
      1 #	$NetBSD: Makefile.inc,v 1.32 2000/01/19 16:30:05 tsutsui 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 KERNMAKE= \
     34 	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:Q}/Makefile \
     35 	    KERNDIR=${KERNDIR:Q} \
     36 	    CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
     37 	    AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
     38 	    LORDER=${LORDER:Q} \
     39 	    TSORT=${TSORT:Q} \
     40 	    LD=${LD:Q} STRIPPROG=${STRIPPROG:Q} \
     41 	    AR=${AR:Q} NM=${NM:Q} \
     42 	    RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
     43 	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
     44 	    KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:Q} \
     45 	    KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:Q} \
     46 	    ${KERNMISCMAKEFLAGS}
     47 
     48 ${KERNLIB}:		.NOTMAIN __always_make_kernlib
     49 	@echo making sure the kern library is up to date...
     50 .if (${KERN_AS} == "library")
     51 	@${KERNMAKE} libkern.a
     52 .else
     53 	@${KERNMAKE} libkern.o
     54 .endif
     55 
     56 ${KERNLIB_PROF}:	.NOTMAIN __always_make_kernlib
     57 	@echo making sure the profiled kern library is up to date...
     58 .if (${KERN_AS} == "library")
     59 	@${KERNMAKE} libkern_p.a
     60 .else
     61 	@${KERNMAKE} libkern.po
     62 .endif
     63 
     64 clean:			.NOTMAIN cleankernlib
     65 cleankernlib:		.NOTMAIN __always_make_kernlib
     66 	@echo cleaning the kern library objects
     67 	@${KERNMAKE} clean
     68 
     69 cleandir distclean:	.NOTMAIN cleandirkernlib
     70 cleandirkernlib:	.NOTMAIN __always_make_kernlib
     71 	@echo cleandiring the kern library objects
     72 	@${KERNMAKE} cleandir
     73 
     74 depend:			.NOTMAIN dependkernlib
     75 dependkernlib:		.NOTMAIN __always_make_kernlib
     76 	@echo depending the kern library objects
     77 	@${KERNMAKE} depend
     78 
     79 __always_make_kernlib:	.NOTMAIN
     80 	@(mkdir -p ${KERNDST})
     81 
     82 .PHONY: __always_make_kernlib
     83 .PHONY: cleankernlib cleandirkernlib dependkernlib
     84