1 # $NetBSD: Makefile.inc,v 1.44.10.1 2018/06/09 15:35:38 martin 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} CPUFLAGS= \ 40 AS=${AS:q} AFLAGS=${AFLAGS:q} \ 41 LORDER=${LORDER:q} \ 42 TSORT=${TSORT:q} \ 43 LD=${LD:q} STRIP=${STRIP:q} \ 44 AR=${AR:q} NM=${NM:q} \ 45 RANLIB=${RANLIB:q} SIZE=${SIZE:q} \ 46 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \ 47 KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:q} \ 48 KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:q} \ 49 LINTFLAGS=${KERNLINTFLAGS:q} \ 50 LIBKERN_ARCH=${LIBKERN_ARCH:q} \ 51 COMMON_MACHINE_ARCH=${COMMON_MACHINE_ARCH:q} \ 52 ${KERNMISCMAKEFLAGS} 53 54 ${KERNLIB}: .NOTMAIN .MAKE __always_make_kernlib 55 @echo making sure the kern library is up to date... 56 .if (${KERN_AS} == "library") 57 @${KERNMAKE} libkern.a 58 .else 59 @${KERNMAKE} libkern.o 60 .endif 61 62 ${KERNLIB_PROF}: .NOTMAIN .MAKE __always_make_kernlib 63 @echo making sure the profiled kern library is up to date... 64 .if (${KERN_AS} == "library") 65 @${KERNMAKE} libkern_p.a 66 .else 67 @${KERNMAKE} libkern.po 68 .endif 69 70 ${KERNLIBLN}: .NOTMAIN .MAKE __always_make_kernlib 71 @echo making sure the kern lint library is up to date... 72 @${KERNMAKE} ${LIBKERNLNBN} 73 74 clean: .NOTMAIN cleankernlib 75 cleankernlib: .NOTMAIN 76 @echo cleaning the kern library objects 77 @if [ -d "${KERNDST}" ]; then ${KERNMAKE} clean; fi 78 79 cleandir distclean: .NOTMAIN cleandirkernlib 80 cleandirkernlib: .NOTMAIN 81 @echo cleandiring the kern library objects 82 @if [ -d "${KERNDST}" ]; then ${KERNMAKE} cleandir; fi 83 84 dependall depend: .NOTMAIN dependkernlib 85 dependkernlib: .NOTMAIN .MAKE __always_make_kernlib 86 @echo depending the kern library objects 87 @${KERNMAKE} depend 88 89 __always_make_kernlib: .NOTMAIN 90 @(mkdir -p ${KERNDST}) 91 92 .PHONY: __always_make_kernlib 93 .PHONY: cleankernlib cleandirkernlib dependkernlib 94 95 .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc" 96