Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.48
      1  1.48     lukem #	$NetBSD: bsd.dep.mk,v 1.48 2003/07/28 08:59:52 lukem 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.1   mycroft .if defined(SRCS)
     18  1.35   thorpej __acpp_flags=	-traditional-cpp
     19  1.33        tv .NOPATH:	.depend
     20  1.48     lukem SRCS_C=	${SRCS:M*.c} ${DPSRCS:M*.c}
     21  1.48     lukem DEPS_C=	${SRCS_C:C/(.*)/\1.dep/g:S/^.dep$//}
     22  1.48     lukem SRCS_M=	${SRCS:M*.m} ${DPSRCS:M*.m}
     23  1.48     lukem DEPS_M=	${SRCS_M:C/(.*)/\1.dep/g:S/^.dep$//}
     24  1.48     lukem SRCS_S=	${SRCS:M*.[sS]} ${DPSRCS:M*.[sS]}
     25  1.48     lukem DEPS_S=	${SRCS_S:C/(.*)/\1.dep/g:S/^.dep$//}
     26  1.48     lukem SRCS_X=	${SRCS:M*.C} ${DPSRCS:M*.C} \
     27  1.48     lukem 	${SRCS:M*.cc} ${DPSRCS:M*.cc} \
     28  1.48     lukem 	${SRCS:M*.cpp} ${DPSRCS:M*.cpp} \
     29  1.48     lukem 	${SRCS:M*.cxx} ${DPSRCS:M*.cxx}
     30  1.48     lukem DEPS_X=	${SRCS_X:C/(.*)/\1.dep/g:S/^.dep$//}
     31  1.48     lukem 
     32  1.48     lukem CLEANDEPEND+=${DEPS_C} ${DEPS_M} ${DEPS_S} ${DEPS_X}
     33  1.48     lukem 
     34  1.48     lukem .depend: ${SRCS} ${DPSRCS} ${DEPS_C} ${DEPS_M} ${DEPS_S} ${DEPS_X}
     35  1.39  christos 	@rm -f .depend
     36  1.48     lukem 	cat ${.ALLSRC:M*.dep} > .depend
     37  1.39  christos 
     38  1.48     lukem .for F in ${DEPS_C:O:u}
     39  1.48     lukem .NOPATH: ${F}
     40  1.48     lukem ${F}: ${F:R}
     41  1.48     lukem 	${MKDEP} -a -f ${.TARGET} ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \
     42  1.48     lukem 	    ${CPPFLAGS.${.ALLSRC:T}} ${.ALLSRC}
     43  1.39  christos .endfor
     44  1.39  christos 
     45  1.48     lukem .for F in ${DEPS_M:O:u}
     46  1.48     lukem .NOPATH: ${F}
     47  1.48     lukem ${F}: ${F:R}
     48  1.48     lukem 	${MKDEP} -a -f ${.TARGET} ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} \
     49  1.48     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.ALLSRC:T}} ${.ALLSRC}
     50  1.39  christos .endfor
     51  1.39  christos 
     52  1.48     lukem .for F in ${DEPS_S:O:u}
     53  1.48     lukem .NOPATH: ${F}
     54  1.48     lukem ${F}: ${F:R}
     55  1.48     lukem 	${MKDEP} -a -f ${.TARGET} ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \
     56  1.48     lukem 	    ${CPPFLAGS.${.ALLSRC:T}} ${__acpp_flags} ${AINC} ${.ALLSRC}
     57  1.39  christos .endfor
     58  1.39  christos 
     59  1.48     lukem .for F in ${DEPS_X:O:u}
     60  1.48     lukem .NOPATH: ${F}
     61  1.48     lukem ${F}: ${F:R}
     62  1.48     lukem 	${MKDEP} -a -f ${.TARGET} ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \
     63  1.47       mrg 	    ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \
     64  1.48     lukem 	    ${DESTDIR}/usr/include/g++} \
     65  1.48     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.ALLSRC:T}} ${.ALLSRC}
     66  1.39  christos .endfor
     67  1.39  christos 
     68  1.33        tv .endif # defined(SRCS)
     69  1.33        tv 
     70  1.33        tv ##### Clean rules
     71  1.19   mycroft cleandepend:
     72  1.33        tv .if defined(SRCS)
     73  1.27  sommerfe 	rm -f .depend ${.CURDIR}/tags ${CLEANDEPEND}
     74   1.3   mycroft .endif
     75   1.2   mycroft 
     76  1.33        tv ##### Custom rules
     77   1.2   mycroft .if !target(tags)
     78  1.33        tv tags: ${SRCS}
     79   1.4   mycroft .if defined(SRCS)
     80   1.2   mycroft 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
     81   1.2   mycroft 	    sed "s;\${.CURDIR}/;;" > tags
     82   1.4   mycroft .endif
     83   1.4   mycroft .endif
     84