bsd.dep.mk revision 1.59
1# $NetBSD: bsd.dep.mk,v 1.59 2003/10/19 03:00:55 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 ${_MKMSGCREATE} 33 ${_MKCMD}\ 34 rm -f .depend 35 ${_MKCMD}\ 36 cat ${__DPSRCS.d} /dev/null > .depend 37 38.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m 39 40.c.d: 41 ${_MKMSGCREATE} 42 ${_MKCMD}\ 43 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \ 44 ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 45 46.m.d: 47 ${_MKMSGCREATE} 48 ${_MKCMD}\ 49 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} \ 50 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 51 52.s.d .S.d: 53 ${_MKMSGCREATE} 54 ${_MKCMD}\ 55 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \ 56 ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${AINC} ${.IMPSRC} 57 58.C.d .cc.d .cpp.d .cxx.d: 59 ${_MKMSGCREATE} 60 ${_MKCMD}\ 61 ${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \ 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: 70.if defined(SRCS) 71 ${_MKCMD}\ 72 rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND} 73.endif 74 75##### Custom rules 76.if !target(tags) 77tags: ${SRCS} 78.if defined(SRCS) 79 ${_MKCMD}\ 80 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 81 sed "s;\${.CURDIR}/;;" > tags 82.endif 83.endif 84