bsd.dep.mk revision 1.73
1# $NetBSD: bsd.dep.mk,v 1.73 2011/09/10 16:57:35 apb Exp $ 2 3##### Basic targets 4realdepend: beforedepend .depend afterdepend 5.ORDER: beforedepend .depend afterdepend 6 7beforedepend .depend afterdepend: # ensure existence 8 9##### Default values 10MKDEP?= mkdep 11MKDEP_SUFFIXES?= .o 12 13##### Build rules 14# some of the rules involve .h sources, so remove them from mkdep line 15 16.if defined(SRCS) # { 17__acpp_flags= ${_ASM_TRADITIONAL_CPP} 18 19__DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ 20 ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 21__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} 22__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} 23 24.NOPATH: .depend ${__DPSRCS.d} 25 26.if !empty(__DPSRCS.d) # { 27${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} 28.endif # } 29 30.depend: ${__DPSRCS.d} 31 ${_MKTARGET_CREATE} 32 rm -f .depend 33 ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d} 34 35.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 36 37.c.d: 38 ${_MKTARGET_CREATE} 39 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 40 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 41 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 42 43.m.d: 44 ${_MKTARGET_CREATE} 45 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 46 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 47 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 48 49.s.d .S.d: 50 ${_MKTARGET_CREATE} 51 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 52 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 53 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC} 54 55.C.d .cc.d .cpp.d .cxx.d: 56 ${_MKTARGET_CREATE} 57 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 58 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 59 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 60 61.endif # defined(SRCS) # } 62 63##### Clean rules 64.if defined(SRCS) 65CLEANDIRFILES+= .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 66.endif 67 68##### Custom rules 69.if !target(tags) 70tags: ${SRCS} 71.if defined(SRCS) 72 -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 73 ${TOOL_SED} "s;\${.CURDIR}/;;" > tags 74.endif 75.endif 76 77##### Pull in related .mk logic 78.include <bsd.clean.mk> 79