1 # $NetBSD: Makefile.inc,v 1.44.16.2 2018/09/30 01:45:55 pgoyette 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 'obj' if OPT_MODULAR is set. Otherwise, 11 # 'library' is used as a default value. 12 # KERNMISCCPPFLAGS 13 # Miscellaneous cpp flags to be passed to the library's Makefile 14 # when building. 15 # KERNMISCMAKEFLAGS 16 # Miscellaneous flags to be passed to the library's Makefile when 17 # building. See library's Makefile for more details about 18 # supported flags and their default values. 19 20 # Default values: 21 KERNDST?= ${.OBJDIR}/lib/kern 22 .if !empty(OPT_MODULAR) 23 KERN_AS?= obj 24 .else 25 KERN_AS?= library 26 .endif 27 KERNDOTDIR?= ../../. 28 29 KERNDIR= ${S:S@^.@${KERNDOTDIR}@:q}/lib/libkern 30 .if (${KERN_AS} == "obj") 31 KERNLIB= ${KERNDST}/libkern.o 32 KERNLIB_PROF= ${KERNDST}/libkern.po 33 .else 34 KERNLIB= ${KERNDST}/libkern.a 35 KERNLIB_PROF= ${KERNDST}/libkern_p.a 36 .endif 37 38 LIBKERNLNBN= llib-lkern.ln 39 KERNLIBLN= ${KERNDST}/${LIBKERNLNBN} 40 41 KERNMAKE= \ 42 cd ${KERNDST} && ${MAKE} -f ${KERNDIR:q}/Makefile \ 43 KERNDIR=${KERNDIR:q} \ 44 CC=${CC:q} CFLAGS=${CFLAGS:q} CPUFLAGS= \ 45 AS=${AS:q} AFLAGS=${AFLAGS:q} \ 46 LORDER=${LORDER:q} \ 47 TSORT=${TSORT:q} \ 48 LD=${LD:q} STRIP=${STRIP:q} \ 49 AR=${AR:q} NM=${NM:q} \ 50 RANLIB=${RANLIB:q} SIZE=${SIZE:q} \ 51 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \ 52 KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:q} \ 53 KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:q} \ 54 LINTFLAGS=${KERNLINTFLAGS:q} \ 55 LIBKERN_ARCH=${LIBKERN_ARCH:q} \ 56 COMMON_MACHINE_ARCH=${COMMON_MACHINE_ARCH:q} \ 57 ${KERNMISCMAKEFLAGS} 58 59 ${KERNLIB}: .NOTMAIN .MAKE __always_make_kernlib 60 @echo making sure the kern library is up to date... 61 .if (${KERN_AS} == "library") 62 @${KERNMAKE} libkern.a 63 .else 64 @${KERNMAKE} libkern.o 65 .endif 66 67 ${KERNLIB_PROF}: .NOTMAIN .MAKE __always_make_kernlib 68 @echo making sure the profiled kern library is up to date... 69 .if (${KERN_AS} == "library") 70 @${KERNMAKE} libkern_p.a 71 .else 72 @${KERNMAKE} libkern.po 73 .endif 74 75 ${KERNLIBLN}: .NOTMAIN .MAKE __always_make_kernlib 76 @echo making sure the kern lint library is up to date... 77 @${KERNMAKE} ${LIBKERNLNBN} 78 79 clean: .NOTMAIN cleankernlib 80 cleankernlib: .NOTMAIN 81 @echo cleaning the kern library objects 82 @if [ -d "${KERNDST}" ]; then ${KERNMAKE} clean; fi 83 84 cleandir distclean: .NOTMAIN cleandirkernlib 85 cleandirkernlib: .NOTMAIN 86 @echo cleandiring the kern library objects 87 @if [ -d "${KERNDST}" ]; then ${KERNMAKE} cleandir; fi 88 89 dependall depend: .NOTMAIN dependkernlib 90 dependkernlib: .NOTMAIN .MAKE __always_make_kernlib 91 @echo depending the kern library objects 92 @${KERNMAKE} depend 93 94 __always_make_kernlib: .NOTMAIN 95 @(mkdir -p ${KERNDST}) 96 97 .PHONY: __always_make_kernlib 98 .PHONY: cleankernlib cleandirkernlib dependkernlib 99 100 .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc" 101