bsd.dep.mk revision 1.60
1# $NetBSD: bsd.dep.mk,v 1.60 2003/10/21 10:01:21 lukem 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__acpp_flags= -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 cat ${__DPSRCS.d} /dev/null > .depend 35 36.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 37 38.c.d: 39 ${_MKTARGET_CREATE} 40 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \ 41 ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 42 43.m.d: 44 ${_MKTARGET_CREATE} 45 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} \ 46 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 47 48.s.d .S.d: 49 ${_MKTARGET_CREATE} 50 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \ 51 ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${AINC} ${.IMPSRC} 52 53.C.d .cc.d .cpp.d .cxx.d: 54 ${_MKTARGET_CREATE} 55 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \ 56 ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \ 57 ${DESTDIR}/usr/include/g++} \ 58 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 59 60.endif # defined(SRCS) # } 61 62##### Clean rules 63cleandepend: 64.if defined(SRCS) 65 rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 66.endif 67 68##### Custom rules 69.if !target(tags) 70tags: ${SRCS} 71.if defined(SRCS) 72 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 73 sed "s;\${.CURDIR}/;;" > tags 74.endif 75.endif 76