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