1 1.76 christos # $NetBSD: bsd.dep.mk,v 1.76 2013/03/05 02:02:07 christos Exp $ 2 1.13 gwr 3 1.33 tv ##### Basic targets 4 1.33 tv realdepend: beforedepend .depend afterdepend 5 1.33 tv .ORDER: beforedepend .depend afterdepend 6 1.14 mycroft 7 1.33 tv beforedepend .depend afterdepend: # ensure existence 8 1.33 tv 9 1.33 tv ##### Default values 10 1.63 dsl MKDEP?= mkdep 11 1.63 dsl MKDEP_SUFFIXES?= .o 12 1.1 mycroft 13 1.33 tv ##### Build rules 14 1.1 mycroft # some of the rules involve .h sources, so remove them from mkdep line 15 1.33 tv 16 1.75 apb .if defined(SRCS) && !empty(SRCS) 17 1.70 joerg __acpp_flags= ${_ASM_TRADITIONAL_CPP} 18 1.48 lukem 19 1.74 matt .if defined(NODPSRCS) 20 1.74 matt .for f in ${SRCS} ${DPSRCS} 21 1.74 matt .if "${NODPSRCS:M${f}}" == "" 22 1.74 matt __DPSRCS.all+= ${f:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 23 1.74 matt .endif 24 1.74 matt .endfor 25 1.74 matt beforedepend: ${DPSRCS} 26 1.74 matt .else 27 1.74 matt __DPSRCS.all+= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ 28 1.55 lukem ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 29 1.74 matt .endif 30 1.55 lukem __DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} 31 1.55 lukem __DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} 32 1.48 lukem 33 1.55 lukem .NOPATH: .depend ${__DPSRCS.d} 34 1.53 lukem 35 1.56 martin .if !empty(__DPSRCS.d) # { 36 1.55 lukem ${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} 37 1.56 martin .endif # } 38 1.55 lukem 39 1.76 christos MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q} 40 1.76 christos 41 1.76 christos .if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no" 42 1.76 christos _MKDEP_MERGEFLAGS=-i 43 1.76 christos _MKDEP_FILEFLAGS=${MKDEPSUFFLAGS} 44 1.76 christos .else 45 1.76 christos _MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS} 46 1.76 christos _MKDEP_FILEFLAGS= 47 1.76 christos .endif 48 1.76 christos 49 1.55 lukem .depend: ${__DPSRCS.d} 50 1.60 lukem ${_MKTARGET_CREATE} 51 1.58 lukem rm -f .depend 52 1.76 christos ${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d} 53 1.39 christos 54 1.57 lukem .SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 55 1.49 lukem 56 1.51 lukem .c.d: 57 1.60 lukem ${_MKTARGET_CREATE} 58 1.76 christos ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 59 1.65 lukem ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 60 1.65 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 61 1.39 christos 62 1.51 lukem .m.d: 63 1.60 lukem ${_MKTARGET_CREATE} 64 1.76 christos ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 65 1.65 lukem ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 66 1.49 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 67 1.39 christos 68 1.51 lukem .s.d .S.d: 69 1.60 lukem ${_MKTARGET_CREATE} 70 1.76 christos ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 71 1.65 lukem ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 72 1.67 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC} 73 1.39 christos 74 1.51 lukem .C.d .cc.d .cpp.d .cxx.d: 75 1.60 lukem ${_MKTARGET_CREATE} 76 1.76 christos ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 77 1.65 lukem ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 78 1.49 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 79 1.39 christos 80 1.75 apb .endif # defined(SRCS) && !empty(SRCS) # } 81 1.33 tv 82 1.33 tv ##### Clean rules 83 1.75 apb .if defined(SRCS) && !empty(SRCS) 84 1.73 apb CLEANDIRFILES+= .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 85 1.3 mycroft .endif 86 1.2 mycroft 87 1.33 tv ##### Custom rules 88 1.2 mycroft .if !target(tags) 89 1.33 tv tags: ${SRCS} 90 1.75 apb .if defined(SRCS) && !empty(SRCS) 91 1.69 christos -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 92 1.68 apb ${TOOL_SED} "s;\${.CURDIR}/;;" > tags 93 1.4 mycroft .endif 94 1.4 mycroft .endif 95 1.73 apb 96 1.73 apb ##### Pull in related .mk logic 97 1.73 apb .include <bsd.clean.mk> 98