bsd.dep.mk revision 1.76
1# $NetBSD: bsd.dep.mk,v 1.76 2013/03/05 02:02:07 christos 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 39MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q} 40 41.if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no" 42_MKDEP_MERGEFLAGS=-i 43_MKDEP_FILEFLAGS=${MKDEPSUFFLAGS} 44.else 45_MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS} 46_MKDEP_FILEFLAGS= 47.endif 48 49.depend: ${__DPSRCS.d} 50 ${_MKTARGET_CREATE} 51 rm -f .depend 52 ${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d} 53 54.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 55 56.c.d: 57 ${_MKTARGET_CREATE} 58 ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 59 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 60 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 61 62.m.d: 63 ${_MKTARGET_CREATE} 64 ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 65 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 66 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 67 68.s.d .S.d: 69 ${_MKTARGET_CREATE} 70 ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 71 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 72 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC} 73 74.C.d .cc.d .cpp.d .cxx.d: 75 ${_MKTARGET_CREATE} 76 ${MKDEP} -f ${.TARGET} ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \ 77 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 78 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 79 80.endif # defined(SRCS) && !empty(SRCS) # } 81 82##### Clean rules 83.if defined(SRCS) && !empty(SRCS) 84CLEANDIRFILES+= .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 85.endif 86 87##### Custom rules 88.if !target(tags) 89tags: ${SRCS} 90.if defined(SRCS) && !empty(SRCS) 91 -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 92 ${TOOL_SED} "s;\${.CURDIR}/;;" > tags 93.endif 94.endif 95 96##### Pull in related .mk logic 97.include <bsd.clean.mk> 98