Makefile.inc revision 1.25
1# $NetBSD: Makefile.inc,v 1.25 2020/09/07 01:54:26 mrg Exp $ 2# 3# Configuration variables (default values are below): 4# 5# S must be set to the top of the 'sys' tree. 6# SADST may be set to the location of the directory where library 7# objects are to be built. Defaults to ${.OBJDIR}/lib/sa. 8# SA_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# SAMISCCPPFLAGS 12# Miscellaneous cpp flags to be passed to the library's Makefile 13# when building. 14# SAMISCMAKEFLAGS 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: 20SADST?= ${.OBJDIR}/lib/sa 21SA_AS?= library 22SADOTDIR?= ../../. 23 24CWARNFLAGS.clang+= -Wno-format-extra-args 25CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} 26 27SADIR= ${S:S@^.@${SADOTDIR}@:q}/lib/libsa 28.if (${SA_AS} == "obj") 29SALIB= ${SADST}/libsa.o 30SALIB_PROF= ${SADST}/libsa.po 31.else 32SALIB= ${SADST}/libsa.a 33SALIB_PROF= ${SADST}/libsa_p.a 34.endif 35ZLIBSRCDIR:= ${.PARSEDIR}/../../../common/dist/zlib 36SAMISCCPPFLAGS+=-I${ZLIBSRCDIR} 37 38SAMAKE= \ 39 cd ${SADST} && ${MAKE} -f ${SADIR:q}/Makefile \ 40 SADIR=${SADIR:q} \ 41 CC=${CC:q} CFLAGS=${CFLAGS:q} CPUFLAGS= \ 42 AS=${AS:q} AFLAGS=${AFLAGS:q} \ 43 LORDER=${LORDER:q} \ 44 TSORT=${TSORT:q} \ 45 LD=${LD:q} STRIP=${STRIP:q} \ 46 AR=${AR:q} NM=${NM:q} \ 47 RANLIB=${RANLIB:q} SIZE=${SIZE:q} \ 48 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \ 49 SACPPFLAGS=${CPPFLAGS:S@^-I.@-I${SADOTDIR}@g:q} \ 50 SAMISCCPPFLAGS=${SAMISCCPPFLAGS:q} \ 51 ${SAMISCMAKEFLAGS} 52 53${SALIB}: .NOTMAIN .MAKE __always_make_salib 54 @echo making sure the sa library is up to date... 55.if (${SA_AS} == "library") 56 @${SAMAKE} libsa.a 57.else 58 @${SAMAKE} libsa.o 59.endif 60 61${SALIB_PROF}: .NOTMAIN .MAKE __always_make_salib 62 @echo making sure the profiled sa library is up to date... 63.if (${SA_AS} == "library") 64 @${SAMAKE} libsa_p.a 65.else 66 @${SAMAKE} libsa.po 67.endif 68 69clean: .NOTMAIN cleansalib 70cleansalib: .NOTMAIN 71 @echo cleaning the sa library objects 72 @if [ -d "${SADST}" ]; then ${SAMAKE} clean; fi 73 74cleandir distclean: .NOTMAIN cleandirsalib 75cleandirsalib: .NOTMAIN 76 @echo cleandiring the sa library objects 77 @if [ -d "${SADST}" ]; then ${SAMAKE} cleandir; fi 78 79dependall depend: .NOTMAIN dependsalib 80dependsalib: .NOTMAIN .MAKE __always_make_salib 81 @echo depending the sa library objects 82 @${SAMAKE} depend 83 84__always_make_salib: .NOTMAIN 85 @mkdir -p ${SADST} 86 87.PHONY: __always_make_salib 88.PHONY: cleansalib cleandirsalib dependsalib 89