1# $NetBSD: Makefile.inc,v 1.27 2023/08/30 18:47:56 christos 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 25 26SADIR= ${S:S@^.@${SADOTDIR}@:q}/lib/libsa 27.if (${SA_AS} == "obj") 28SALIB= ${SADST}/libsa.o 29SALIB_PROF= ${SADST}/libsa.po 30.else 31SALIB= ${SADST}/libsa.a 32SALIB_PROF= ${SADST}/libsa_p.a 33.endif 34ZLIBSRCDIR:= ${.PARSEDIR}/../../../common/dist/zlib 35SAMISCCPPFLAGS+=-I${ZLIBSRCDIR} 36 37SAMAKE= \ 38 cd ${SADST} && ${MAKE} -f ${SADIR:q}/Makefile \ 39 SADIR=${SADIR:q} \ 40 CC=${CC:q} CFLAGS=${CFLAGS:q} CPUFLAGS= \ 41 AS=${AS:q} AFLAGS=${AFLAGS:q} \ 42 LORDER=${LORDER:q} \ 43 TSORT=${TSORT:q} \ 44 LD=${LD:q} STRIP=${STRIP:q} \ 45 AR=${AR:q} NM=${NM:q} \ 46 COPTS=${COPTS: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