1 # $NetBSD: Makefile.inc,v 1.25 1997/02/16 21:25:19 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 # 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?= obj 22 23 KERNDIR= $S/lib/libkern 24 .if (${KERN_AS} == "obj") 25 KERNLIB= ${KERNDST}/libkern.o 26 KERNLIB_PROF= ${KERNDST}/libkern.po 27 .else 28 KERNLIB= ${KERNDST}/libkern.a 29 KERNLIB_PROF= ${KERNDST}/libkern_p.a 30 .endif 31 32 KERNMAKE= \ 33 cd ${KERNDIR} && MAKEOBJDIR=${KERNDST} ${MAKE} \ 34 CC=${CC:Q} CFLAGS=${CFLAGS:Q} \ 35 AS=${AS:Q} AFLAGS=${AFLAGS:Q} \ 36 LD=${LD:Q} STRIP=${STRIP:Q} \ 37 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 38 KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \ 39 KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:Q} \ 40 ${KERNMISCMAKEFLAGS} 41 42 ${KERNLIB}: .NOTMAIN __always_make_kernlib 43 @echo making sure the kern library is up to date... 44 .if (${KERN_AS} == "library") 45 @${KERNMAKE} libkern.a 46 .else 47 @${KERNMAKE} libkern.o 48 .endif 49 50 ${KERNLIB_PROF}: .NOTMAIN __always_make_kernlib 51 @echo making sure the profiled kern library is up to date... 52 .if (${KERN_AS} == "library") 53 @${KERNMAKE} libkern_p.a 54 .else 55 @${KERNMAKE} libkern.po 56 .endif 57 58 clean: .NOTMAIN cleankernlib 59 cleankernlib: .NOTMAIN __always_make_kernlib 60 @echo cleaning the kern library objects 61 @${KERNMAKE} clean 62 63 cleandir: .NOTMAIN cleandirkernlib 64 cleandirkernlib: .NOTMAIN __always_make_kernlib 65 @echo cleandiring the kern library objects 66 @${KERNMAKE} cleandir 67 68 depend: .NOTMAIN dependkernlib 69 dependkernlib: .NOTMAIN __always_make_kernlib 70 @echo depending the kern library objects 71 @${KERNMAKE} depend 72 73 __always_make_kernlib: .NOTMAIN 74 @mkdir -p ${KERNDST} 75