bsd.dep.mk revision 1.66
1# $NetBSD: bsd.dep.mk,v 1.66 2004/01/29 01:48:45 lukem 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_TRADITIONAL_CPP?=-traditional-cpp 19__acpp_flags= ${_TRADITIONAL_CPP} 20 21__DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ 22 ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} 23__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d} 24__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d} 25 26.NOPATH: .depend ${__DPSRCS.d} 27 28.if !empty(__DPSRCS.d) # { 29${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS} 30.endif # } 31 32.depend: ${__DPSRCS.d} 33 ${_MKTARGET_CREATE} 34 rm -f .depend 35 ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d} 36 37.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 38 39.c.d: 40 ${_MKTARGET_CREATE} 41 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 42 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 43 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 44 45.m.d: 46 ${_MKTARGET_CREATE} 47 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 48 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 49 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 50 51.s.d .S.d: 52 ${_MKTARGET_CREATE} 53 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 54 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 55 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${AINC} \ 56 ${.IMPSRC} 57 58.C.d .cc.d .cpp.d .cxx.d: 59 ${_MKTARGET_CREATE} 60 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ 61 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 62 ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \ 63 ${DESTDIR}/usr/include/g++} \ 64 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 65 66.endif # defined(SRCS) # } 67 68##### Clean rules 69cleandepend: .PHONY 70.if defined(SRCS) 71 rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 72.endif 73 74##### Custom rules 75.if !target(tags) 76tags: ${SRCS} 77.if defined(SRCS) 78 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 79 sed "s;\${.CURDIR}/;;" > tags 80.endif 81.endif 82