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