1 1.70 joerg # $NetBSD: bsd.dep.mk,v 1.70 2011/01/12 23:12:11 joerg Exp $ 2 1.13 gwr 3 1.33 tv ##### Basic targets 4 1.32 tv cleandir: cleandepend 5 1.33 tv realdepend: beforedepend .depend afterdepend 6 1.33 tv .ORDER: beforedepend .depend afterdepend 7 1.14 mycroft 8 1.33 tv beforedepend .depend afterdepend: # ensure existence 9 1.33 tv 10 1.33 tv ##### Default values 11 1.63 dsl MKDEP?= mkdep 12 1.63 dsl MKDEP_SUFFIXES?= .o 13 1.1 mycroft 14 1.33 tv ##### Build rules 15 1.1 mycroft # some of the rules involve .h sources, so remove them from mkdep line 16 1.33 tv 17 1.53 lukem .if defined(SRCS) # { 18 1.70 joerg __acpp_flags= ${_ASM_TRADITIONAL_CPP} 19 1.48 lukem 20 1.55 lukem __DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ 21 1.55 lukem ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 22 1.55 lukem __DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} 23 1.55 lukem __DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} 24 1.48 lukem 25 1.55 lukem .NOPATH: .depend ${__DPSRCS.d} 26 1.53 lukem 27 1.56 martin .if !empty(__DPSRCS.d) # { 28 1.55 lukem ${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} 29 1.56 martin .endif # } 30 1.55 lukem 31 1.55 lukem .depend: ${__DPSRCS.d} 32 1.60 lukem ${_MKTARGET_CREATE} 33 1.58 lukem rm -f .depend 34 1.63 dsl ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d} 35 1.39 christos 36 1.57 lukem .SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 37 1.49 lukem 38 1.51 lukem .c.d: 39 1.60 lukem ${_MKTARGET_CREATE} 40 1.65 lukem ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 41 1.65 lukem ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 42 1.65 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 43 1.39 christos 44 1.51 lukem .m.d: 45 1.60 lukem ${_MKTARGET_CREATE} 46 1.65 lukem ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 47 1.65 lukem ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 48 1.49 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 49 1.39 christos 50 1.51 lukem .s.d .S.d: 51 1.60 lukem ${_MKTARGET_CREATE} 52 1.65 lukem ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 53 1.65 lukem ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 54 1.67 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC} 55 1.39 christos 56 1.51 lukem .C.d .cc.d .cpp.d .cxx.d: 57 1.60 lukem ${_MKTARGET_CREATE} 58 1.65 lukem ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 59 1.65 lukem ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 60 1.47 mrg ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \ 61 1.65 lukem ${DESTDIR}/usr/include/g++} \ 62 1.49 lukem ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 63 1.39 christos 64 1.53 lukem .endif # defined(SRCS) # } 65 1.33 tv 66 1.33 tv ##### Clean rules 67 1.66 lukem cleandepend: .PHONY 68 1.33 tv .if defined(SRCS) 69 1.55 lukem rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 70 1.3 mycroft .endif 71 1.2 mycroft 72 1.33 tv ##### Custom rules 73 1.2 mycroft .if !target(tags) 74 1.33 tv tags: ${SRCS} 75 1.4 mycroft .if defined(SRCS) 76 1.69 christos -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 77 1.68 apb ${TOOL_SED} "s;\${.CURDIR}/;;" > tags 78 1.4 mycroft .endif 79 1.4 mycroft .endif 80