Home | History | Annotate | Line # | Download | only in libkern
Makefile.inc revision 1.47
      1 #	$NetBSD: Makefile.inc,v 1.47 2022/05/30 14:13:59 rin 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 LIBKERN_MD_FLAGS?=	none
     42 
     43 KERNMAKE= \
     44 	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:q}/Makefile \
     45 	    KERNDIR=${KERNDIR:q} \
     46 	    CC=${CC:q} CFLAGS=${CFLAGS:q} CPUFLAGS= \
     47 	    AS=${AS:q} AFLAGS=${AFLAGS:q} \
     48 	    LORDER=${LORDER:q} \
     49 	    TSORT=${TSORT:q} \
     50 	    LD=${LD:q} STRIP=${STRIP:q} \
     51 	    AR=${AR:q} NM=${NM:q} \
     52 	    RANLIB=${RANLIB:q} SIZE=${SIZE:q} \
     53 	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
     54 	    KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:q} \
     55 	    KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:q} \
     56 	    LINTFLAGS=${KERNLINTFLAGS:q} \
     57 	    LIBKERN_ARCH=${LIBKERN_ARCH:q} \
     58 	    COMMON_MACHINE_ARCH=${COMMON_MACHINE_ARCH:q} \
     59 	    LIBKERN_MD_FLAGS=${LIBKERN_MD_FLAGS:q} \
     60 	    ${KERNMISCMAKEFLAGS}
     61 
     62 ${KERNLIB}:		.NOTMAIN .MAKE __always_make_kernlib
     63 	@echo making sure the kern library is up to date...
     64 .if (${KERN_AS} == "library")
     65 	@${KERNMAKE} libkern.a
     66 .else
     67 	@${KERNMAKE} libkern.o
     68 .endif
     69 
     70 ${KERNLIB_PROF}:	.NOTMAIN .MAKE __always_make_kernlib
     71 	@echo making sure the profiled kern library is up to date...
     72 .if (${KERN_AS} == "library")
     73 	@${KERNMAKE} libkern_p.a
     74 .else
     75 	@${KERNMAKE} libkern.po
     76 .endif
     77 
     78 ${KERNLIBLN}:		.NOTMAIN .MAKE __always_make_kernlib
     79 	@echo making sure the kern lint library is up to date...
     80 	@${KERNMAKE} ${LIBKERNLNBN}
     81 
     82 clean:			.NOTMAIN cleankernlib
     83 cleankernlib:		.NOTMAIN
     84 	@echo cleaning the kern library objects
     85 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} clean; fi
     86 
     87 cleandir distclean:	.NOTMAIN cleandirkernlib
     88 cleandirkernlib:	.NOTMAIN
     89 	@echo cleandiring the kern library objects
     90 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} cleandir; fi
     91 
     92 dependall depend:	.NOTMAIN dependkernlib
     93 dependkernlib:		.NOTMAIN .MAKE __always_make_kernlib
     94 	@echo depending the kern library objects
     95 	@${KERNMAKE} depend
     96 
     97 __always_make_kernlib:	.NOTMAIN
     98 	@(mkdir -p ${KERNDST})
     99 
    100 .PHONY: __always_make_kernlib
    101 .PHONY: cleankernlib cleandirkernlib dependkernlib
    102 
    103 .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
    104