1 # $NetBSD: Makefile.inc,v 1.24 1997/01/23 22:29:07 cgd 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 # KERNMISCMAKEFLAGS 12 # Miscellaneous flags to be passed to the library's Makefile when 13 # building. See library's Makefile for more details about 14 # supported flags and their default values. 15 16 # Default values: 17 KERNDST?= ${.OBJDIR}/lib/kern 18 KERN_AS?= obj 19 20 KERNDIR= $S/lib/libkern 21 .if (${KERN_AS} == "obj") 22 KERNLIB= ${KERNDST}/libkern.o 23 KERNLIB_PROF= ${KERNDST}/libkern.po 24 .else 25 KERNLIB= ${KERNDST}/libkern.a 26 KERNLIB_PROF= ${KERNDST}/libkern_p.a 27 .endif 28 29 KERNMAKE= \ 30 cd ${KERNDIR} && MAKEOBJDIR=${KERNDST} ${MAKE} \ 31 CC=${CC:Q} CFLAGS=${CFLAGS:Q} \ 32 AS=${AS:Q} AFLAGS=${AFLAGS:Q} \ 33 LD=${LD:Q} STRIP=${STRIP:Q} \ 34 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 35 KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \ 36 ${KERNMISCMAKEFLAGS} 37 38 ${KERNLIB}: .NOTMAIN __always_make_kernlib 39 @echo making sure the kern library is up to date... 40 .if (${KERN_AS} == "library") 41 @${KERNMAKE} libkern.a 42 .else 43 @${KERNMAKE} libkern.o 44 .endif 45 46 ${KERNLIB_PROF}: .NOTMAIN __always_make_kernlib 47 @echo making sure the profiled kern library is up to date... 48 .if (${KERN_AS} == "library") 49 @${KERNMAKE} libkern_p.a 50 .else 51 @${KERNMAKE} libkern.po 52 .endif 53 54 clean: .NOTMAIN cleankernlib 55 cleankernlib: .NOTMAIN __always_make_kernlib 56 @echo cleaning the kern library objects 57 @${KERNMAKE} clean 58 59 cleandir: .NOTMAIN cleandirkernlib 60 cleandirkernlib: .NOTMAIN __always_make_kernlib 61 @echo cleandiring the kern library objects 62 @${KERNMAKE} cleandir 63 64 depend: .NOTMAIN dependkernlib 65 dependkernlib: .NOTMAIN __always_make_kernlib 66 @echo depending the kern library objects 67 @${KERNMAKE} depend 68 69 __always_make_kernlib: .NOTMAIN 70 @mkdir -p ${KERNDST} 71