Home | History | Annotate | Line # | Download | only in libkern
      1  1.50       mrg #	$NetBSD: Makefile.inc,v 1.50 2025/09/20 06:36:50 mrg Exp $
      2   1.1       cgd #
      3  1.24       cgd #	Configuration variables (default values are below):
      4  1.24       cgd #
      5  1.24       cgd #	S	must be set to the top of the 'sys' tree.
      6  1.24       cgd #	KERNDST	may be set to the location of the directory where library
      7  1.24       cgd #		objects are to be built.  Defaults to ${.OBJDIR}/lib/kern.
      8  1.24       cgd #	KERN_AS	may be set to 'obj' to build a object from the library's
      9  1.24       cgd #		object files.  (Otherwise, a library will be built.)
     10  1.46       rin #		Defaults to 'obj' if OPT_MODULAR is set. Otherwise,
     11  1.46       rin #		'library' is used as a default value.
     12  1.25       cgd #	KERNMISCCPPFLAGS
     13  1.25       cgd #		Miscellaneous cpp flags to be passed to the library's Makefile
     14  1.25       cgd #		when building.
     15  1.24       cgd #	KERNMISCMAKEFLAGS
     16  1.24       cgd #		Miscellaneous flags to be passed to the library's Makefile when
     17  1.24       cgd #		building.  See library's Makefile for more details about
     18  1.24       cgd #		supported flags and their default values.
     19   1.1       cgd 
     20  1.24       cgd # Default values:
     21  1.16   mycroft KERNDST?=	${.OBJDIR}/lib/kern
     22  1.46       rin .if !empty(OPT_MODULAR)
     23  1.46       rin KERN_AS?=	obj
     24  1.46       rin .else
     25  1.30  drochner KERN_AS?=	library
     26  1.46       rin .endif
     27  1.31  drochner KERNDOTDIR?= ../../.
     28  1.22        ws 
     29  1.45  christos KERNDIR=	${S:S@^.@${KERNDOTDIR}@:q}/lib/libkern
     30  1.24       cgd .if (${KERN_AS} == "obj")
     31  1.24       cgd KERNLIB=	${KERNDST}/libkern.o
     32  1.24       cgd KERNLIB_PROF=	${KERNDST}/libkern.po
     33  1.24       cgd .else
     34  1.22        ws KERNLIB=	${KERNDST}/libkern.a
     35  1.22        ws KERNLIB_PROF=	${KERNDST}/libkern_p.a
     36  1.22        ws .endif
     37   1.1       cgd 
     38  1.36     perry LIBKERNLNBN=	llib-lkern.ln
     39  1.36     perry KERNLIBLN=	${KERNDST}/${LIBKERNLNBN}
     40  1.36     perry 
     41  1.47       rin LIBKERN_MD_FLAGS?=	none
     42  1.47       rin 
     43  1.13   mycroft KERNMAKE= \
     44  1.48    rillig 	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:Q}/Makefile \
     45  1.45  christos 	    KERNDIR=${KERNDIR:q} \
     46  1.45  christos 	    CC=${CC:q} CFLAGS=${CFLAGS:q} CPUFLAGS= \
     47  1.45  christos 	    AS=${AS:q} AFLAGS=${AFLAGS:q} \
     48  1.45  christos 	    LORDER=${LORDER:q} \
     49  1.45  christos 	    TSORT=${TSORT:q} \
     50  1.49  christos 	    COPTS=${COPTS:q} \
     51  1.45  christos 	    LD=${LD:q} STRIP=${STRIP:q} \
     52  1.45  christos 	    AR=${AR:q} NM=${NM:q} \
     53  1.45  christos 	    RANLIB=${RANLIB:q} SIZE=${SIZE:q} \
     54  1.45  christos 	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
     55  1.45  christos 	    KERNCPPFLAGS=${CPPFLAGS:S@^-I.@-I${KERNDOTDIR}@g:q} \
     56  1.45  christos 	    KERNMISCCPPFLAGS=${KERNMISCCPPFLAGS:q} \
     57  1.45  christos 	    LINTFLAGS=${KERNLINTFLAGS:q} \
     58  1.45  christos 	    LIBKERN_ARCH=${LIBKERN_ARCH:q} \
     59  1.45  christos 	    COMMON_MACHINE_ARCH=${COMMON_MACHINE_ARCH:q} \
     60  1.47       rin 	    LIBKERN_MD_FLAGS=${LIBKERN_MD_FLAGS:q} \
     61  1.24       cgd 	    ${KERNMISCMAKEFLAGS}
     62  1.13   mycroft 
     63  1.34  sommerfe ${KERNLIB}:		.NOTMAIN .MAKE __always_make_kernlib
     64   1.1       cgd 	@echo making sure the kern library is up to date...
     65  1.22        ws .if (${KERN_AS} == "library")
     66  1.22        ws 	@${KERNMAKE} libkern.a
     67  1.22        ws .else
     68  1.13   mycroft 	@${KERNMAKE} libkern.o
     69  1.22        ws .endif
     70   1.1       cgd 
     71  1.34  sommerfe ${KERNLIB_PROF}:	.NOTMAIN .MAKE __always_make_kernlib
     72   1.1       cgd 	@echo making sure the profiled kern library is up to date...
     73  1.22        ws .if (${KERN_AS} == "library")
     74  1.22        ws 	@${KERNMAKE} libkern_p.a
     75  1.22        ws .else
     76  1.13   mycroft 	@${KERNMAKE} libkern.po
     77  1.22        ws .endif
     78  1.36     perry 
     79  1.36     perry ${KERNLIBLN}:		.NOTMAIN .MAKE __always_make_kernlib
     80  1.36     perry 	@echo making sure the kern lint library is up to date...
     81  1.36     perry 	@${KERNMAKE} ${LIBKERNLNBN}
     82  1.10  christos 
     83  1.24       cgd clean:			.NOTMAIN cleankernlib
     84  1.50       mrg cleankernlib:		.MAKE .NOTMAIN
     85  1.10  christos 	@echo cleaning the kern library objects
     86  1.35       jmc 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} clean; fi
     87  1.14   mycroft 
     88  1.29     lukem cleandir distclean:	.NOTMAIN cleandirkernlib
     89  1.50       mrg cleandirkernlib:	.MAKE .NOTMAIN
     90  1.24       cgd 	@echo cleandiring the kern library objects
     91  1.35       jmc 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} cleandir; fi
     92  1.24       cgd 
     93  1.37       dsl dependall depend:	.NOTMAIN dependkernlib
     94  1.34  sommerfe dependkernlib:		.NOTMAIN .MAKE __always_make_kernlib
     95  1.14   mycroft 	@echo depending the kern library objects
     96  1.14   mycroft 	@${KERNMAKE} depend
     97   1.1       cgd 
     98   1.2       cgd __always_make_kernlib:	.NOTMAIN
     99  1.26   thorpej 	@(mkdir -p ${KERNDST})
    100  1.31  drochner 
    101  1.31  drochner .PHONY: __always_make_kernlib
    102  1.31  drochner .PHONY: cleankernlib cleandirkernlib dependkernlib
    103  1.40  christos 
    104  1.40  christos .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
    105