Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.56
      1  1.56    martin #	$NetBSD: bsd.dep.mk,v 1.56 2003/08/06 13:55:11 martin Exp $
      2  1.13       gwr 
      3  1.33        tv ##### Basic targets
      4  1.15   mycroft .PHONY:		cleandepend
      5  1.32        tv cleandir:	cleandepend
      6  1.33        tv realdepend:	beforedepend .depend afterdepend
      7  1.33        tv .ORDER:		beforedepend .depend afterdepend
      8  1.14   mycroft 
      9  1.33        tv beforedepend .depend afterdepend: # ensure existence
     10  1.33        tv 
     11  1.33        tv ##### Default values
     12  1.14   mycroft MKDEP?=		mkdep
     13   1.1   mycroft 
     14  1.33        tv ##### Build rules
     15   1.1   mycroft # some of the rules involve .h sources, so remove them from mkdep line
     16  1.33        tv 
     17  1.53     lukem .if defined(SRCS)							# {
     18  1.35   thorpej __acpp_flags=	-traditional-cpp
     19  1.48     lukem 
     20  1.55     lukem __DPSRCS.all=	${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
     21  1.55     lukem 		${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
     22  1.55     lukem __DPSRCS.d=	${__DPSRCS.all:O:u:M*.d}
     23  1.55     lukem __DPSRCS.notd=	${__DPSRCS.all:O:u:N*.d}
     24  1.48     lukem 
     25  1.55     lukem .NOPATH: .depend ${__DPSRCS.d}
     26  1.53     lukem 
     27  1.56    martin .if !empty(__DPSRCS.d)							# {
     28  1.55     lukem ${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
     29  1.56    martin .endif									# }
     30  1.55     lukem 
     31  1.55     lukem .depend: ${__DPSRCS.d}
     32  1.39  christos 	@rm -f .depend
     33  1.56    martin 	cat ${__DPSRCS.d} /dev/null > .depend
     34  1.39  christos 
     35  1.51     lukem .SUFFIXES: .d .c .m .s .S .C .cc .cpp .cxx
     36  1.49     lukem 
     37  1.51     lukem .c.d:
     38  1.51     lukem 	${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \
     39  1.49     lukem 	    ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     40  1.39  christos 
     41  1.51     lukem .m.d:
     42  1.51     lukem 	${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} \
     43  1.49     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     44  1.39  christos 
     45  1.51     lukem .s.d .S.d:
     46  1.51     lukem 	${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \
     47  1.49     lukem 	    ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${AINC} ${.IMPSRC}
     48  1.39  christos 
     49  1.51     lukem .C.d .cc.d .cpp.d .cxx.d:
     50  1.51     lukem 	${MKDEP} -f ${.TARGET} ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \
     51  1.47       mrg 	    ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \
     52  1.48     lukem 	    ${DESTDIR}/usr/include/g++} \
     53  1.49     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     54  1.39  christos 
     55  1.53     lukem .endif # defined(SRCS)							# }
     56  1.33        tv 
     57  1.33        tv ##### Clean rules
     58  1.19   mycroft cleandepend:
     59  1.33        tv .if defined(SRCS)
     60  1.55     lukem 	rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND}
     61   1.3   mycroft .endif
     62   1.2   mycroft 
     63  1.33        tv ##### Custom rules
     64   1.2   mycroft .if !target(tags)
     65  1.33        tv tags: ${SRCS}
     66   1.4   mycroft .if defined(SRCS)
     67   1.2   mycroft 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
     68   1.2   mycroft 	    sed "s;\${.CURDIR}/;;" > tags
     69   1.4   mycroft .endif
     70   1.4   mycroft .endif
     71