bsd.dep.mk revision 1.61
1# $NetBSD: bsd.dep.mk,v 1.61 2003/10/27 23:52:57 mrg Exp $ 2 3##### Basic targets 4.PHONY: cleandepend 5cleandir: cleandepend 6realdepend: beforedepend .depend afterdepend 7.ORDER: beforedepend .depend afterdepend 8 9beforedepend .depend afterdepend: # ensure existence 10 11##### Default values 12MKDEP?= mkdep 13 14##### Build rules 15# some of the rules involve .h sources, so remove them from mkdep line 16 17.if defined(SRCS) # { 18_TRADIONAL_CPP?=-traditional-cpp 19__acpp_flags= ${_TRADIONAL_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 cat ${__DPSRCS.d} /dev/null > .depend 36 37.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 38 39.c.d: 40 ${_MKTARGET_CREATE} 41 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \ 42 ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 43 44.m.d: 45 ${_MKTARGET_CREATE} 46 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} \ 47 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 48 49.s.d .S.d: 50 ${_MKTARGET_CREATE} 51 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \ 52 ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${AINC} ${.IMPSRC} 53 54.C.d .cc.d .cpp.d .cxx.d: 55 ${_MKTARGET_CREATE} 56 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \ 57 ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \ 58 ${DESTDIR}/usr/include/g++} \ 59 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 60 61.endif # defined(SRCS) # } 62 63##### Clean rules 64cleandepend: 65.if defined(SRCS) 66 rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 67.endif 68 69##### Custom rules 70.if !target(tags) 71tags: ${SRCS} 72.if defined(SRCS) 73 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 74 sed "s;\${.CURDIR}/;;" > tags 75.endif 76.endif 77