bsd.dep.mk revision 1.75
1# $NetBSD: bsd.dep.mk,v 1.75 2012/11/18 19:48:29 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) && !empty(SRCS) 17__acpp_flags= ${_ASM_TRADITIONAL_CPP} 18 19.if defined(NODPSRCS) 20.for f in ${SRCS} ${DPSRCS} 21.if "${NODPSRCS:M${f}}" == "" 22__DPSRCS.all+= ${f:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 23.endif 24.endfor 25beforedepend: ${DPSRCS} 26.else 27__DPSRCS.all+= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ 28 ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 29.endif 30__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} 31__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} 32 33.NOPATH: .depend ${__DPSRCS.d} 34 35.if !empty(__DPSRCS.d) # { 36${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} 37.endif # } 38 39.depend: ${__DPSRCS.d} 40 ${_MKTARGET_CREATE} 41 rm -f .depend 42 ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d} 43 44.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 45 46.c.d: 47 ${_MKTARGET_CREATE} 48 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 49 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 50 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 51 52.m.d: 53 ${_MKTARGET_CREATE} 54 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 55 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 56 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 57 58.s.d .S.d: 59 ${_MKTARGET_CREATE} 60 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 61 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 62 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC} 63 64.C.d .cc.d .cpp.d .cxx.d: 65 ${_MKTARGET_CREATE} 66 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 67 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 68 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 69 70.endif # defined(SRCS) && !empty(SRCS) # } 71 72##### Clean rules 73.if defined(SRCS) && !empty(SRCS) 74CLEANDIRFILES+= .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 75.endif 76 77##### Custom rules 78.if !target(tags) 79tags: ${SRCS} 80.if defined(SRCS) && !empty(SRCS) 81 -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 82 ${TOOL_SED} "s;\${.CURDIR}/;;" > tags 83.endif 84.endif 85 86##### Pull in related .mk logic 87.include <bsd.clean.mk> 88