1 # $NetBSD: Makefile.inc,v 1.19 2006/01/26 14:05:49 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: 20 SADST?= ${.OBJDIR}/lib/sa 21 SA_AS?= library 22 SADOTDIR?= ../../. 23 24 SADIR= ${S:S@^.@${SADOTDIR}@:Q}/lib/libsa 25 .if (${SA_AS} == "obj") 26 SALIB= ${SADST}/libsa.o 27 SALIB_PROF= ${SADST}/libsa.po 28 .else 29 SALIB= ${SADST}/libsa.a 30 SALIB_PROF= ${SADST}/libsa_p.a 31 .endif 32 ZLIBSRCDIR:= ${.PARSEDIR}/../../../common/dist/zlib 33 SAMISCCPPFLAGS+=-I${ZLIBSRCDIR} 34 35 SAMAKE= \ 36 cd ${SADST} && ${MAKE} -f ${SADIR:Q}/Makefile \ 37 SADIR=${SADIR:Q} \ 38 CC=${CC:Q} CFLAGS=${CFLAGS:Q} \ 39 AS=${AS:Q} AFLAGS=${AFLAGS:Q} \ 40 LORDER=${LORDER:Q} \ 41 TSORT=${TSORT:Q} \ 42 LD=${LD:Q} STRIP=${STRIP:Q} \ 43 AR=${AR:Q} NM=${NM:Q} \ 44 RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \ 45 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 46 SACPPFLAGS=${CPPFLAGS:S@^-I.@-I${SADOTDIR}@g:Q} \ 47 SAMISCCPPFLAGS=${SAMISCCPPFLAGS:Q} \ 48 ${SAMISCMAKEFLAGS} 49 50 ${SALIB}: .NOTMAIN .MAKE __always_make_salib 51 @echo making sure the sa library is up to date... 52 .if (${SA_AS} == "library") 53 @${SAMAKE} libsa.a 54 .else 55 @${SAMAKE} libsa.o 56 .endif 57 58 ${SALIB_PROF}: .NOTMAIN .MAKE __always_make_salib 59 @echo making sure the profiled sa library is up to date... 60 .if (${SA_AS} == "library") 61 @${SAMAKE} libsa_p.a 62 .else 63 @${SAMAKE} libsa.po 64 .endif 65 66 clean: .NOTMAIN cleansalib 67 cleansalib: .NOTMAIN 68 @echo cleaning the sa library objects 69 @if [ -d "${SADST}" ]; then ${SAMAKE} clean; fi 70 71 cleandir distclean: .NOTMAIN cleandirsalib 72 cleandirsalib: .NOTMAIN 73 @echo cleandiring the sa library objects 74 @if [ -d "${SADST}" ]; then ${SAMAKE} cleandir; fi 75 76 dependall depend: .NOTMAIN dependsalib 77 dependsalib: .NOTMAIN .MAKE __always_make_salib 78 @echo depending the sa library objects 79 @${SAMAKE} depend 80 81 __always_make_salib: .NOTMAIN 82 @mkdir -p ${SADST} 83 84 .PHONY: __always_make_salib 85 .PHONY: cleansalib cleandirsalib dependsalib 86