1# $NetBSD: bsd.dep.mk,v 1.35 2002/06/04 21:22:54 thorpej 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.if defined(HAVE_GCC3) 19__acpp_flags= 20.else 21__acpp_flags= -traditional-cpp 22.endif 23.NOPATH: .depend 24.depend: ${SRCS} ${DPSRCS} 25 @rm -f .depend 26 @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \ 27 if [ "$$files" != " " ]; then \ 28 echo ${MKDEP} -a ${MKDEPFLAGS} \ 29 ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${__acpp_flags} ${AINC:Q} \ 30 $$files; \ 31 ${MKDEP} -a ${MKDEPFLAGS} \ 32 ${AFLAGS:M-[ID]*} ${CPPFLAGS} ${__acpp_flags} ${AINC} $$files; \ 33 fi 34 @files="${.ALLSRC:M*.c}"; \ 35 if [ "$$files" != "" ]; then \ 36 echo ${MKDEP} -a ${MKDEPFLAGS} \ 37 ${CFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ 38 ${MKDEP} -a ${MKDEPFLAGS} \ 39 ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ 40 fi 41 @files="${.ALLSRC:M*.m}"; \ 42 if [ "$$files" != "" ]; then \ 43 echo ${MKDEP} -a ${MKDEPFLAGS} \ 44 ${OBJCFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ 45 ${MKDEP} -a ${MKDEPFLAGS} \ 46 ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ 47 fi 48 @files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \ 49 if [ "$$files" != " " ]; then \ 50 echo ${MKDEP} -a ${MKDEPFLAGS} \ 51 ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ 52 ${MKDEP} -a ${MKDEPFLAGS} \ 53 ${CXXFLAGS:M-[ID]*} ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++} ${CPPFLAGS} $$files; \ 54 fi 55.endif # defined(SRCS) 56 57##### Clean rules 58cleandepend: 59.if defined(SRCS) 60 rm -f .depend ${.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