Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.65
      1  1.65     lukem #	$NetBSD: bsd.dep.mk,v 1.65 2004/01/27 03:31:48 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.63       dsl MKDEP?=			mkdep
     13  1.63       dsl MKDEP_SUFFIXES?=	.o
     14   1.1   mycroft 
     15  1.33        tv ##### Build rules
     16   1.1   mycroft # some of the rules involve .h sources, so remove them from mkdep line
     17  1.33        tv 
     18  1.53     lukem .if defined(SRCS)							# {
     19  1.62       mrg _TRADITIONAL_CPP?=-traditional-cpp
     20  1.62       mrg __acpp_flags=	${_TRADITIONAL_CPP}
     21  1.48     lukem 
     22  1.55     lukem __DPSRCS.all=	${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
     23  1.55     lukem 		${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
     24  1.55     lukem __DPSRCS.d=	${__DPSRCS.all:O:u:M*.d}
     25  1.55     lukem __DPSRCS.notd=	${__DPSRCS.all:O:u:N*.d}
     26  1.48     lukem 
     27  1.55     lukem .NOPATH: .depend ${__DPSRCS.d}
     28  1.53     lukem 
     29  1.56    martin .if !empty(__DPSRCS.d)							# {
     30  1.55     lukem ${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
     31  1.56    martin .endif									# }
     32  1.55     lukem 
     33  1.55     lukem .depend: ${__DPSRCS.d}
     34  1.60     lukem 	${_MKTARGET_CREATE}
     35  1.58     lukem 	rm -f .depend
     36  1.63       dsl 	${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d}
     37  1.39  christos 
     38  1.57     lukem .SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
     39  1.49     lukem 
     40  1.51     lukem .c.d:
     41  1.60     lukem 	${_MKTARGET_CREATE}
     42  1.65     lukem 	${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
     43  1.65     lukem 	    ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     44  1.65     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     45  1.39  christos 
     46  1.51     lukem .m.d:
     47  1.60     lukem 	${_MKTARGET_CREATE}
     48  1.65     lukem 	${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
     49  1.65     lukem 	    ${OBJCFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     50  1.49     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     51  1.39  christos 
     52  1.51     lukem .s.d .S.d:
     53  1.60     lukem 	${_MKTARGET_CREATE}
     54  1.65     lukem 	${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
     55  1.65     lukem 	    ${AFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     56  1.65     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${AINC} \
     57  1.65     lukem 	    ${.IMPSRC}
     58  1.39  christos 
     59  1.51     lukem .C.d .cc.d .cpp.d .cxx.d:
     60  1.60     lukem 	${_MKTARGET_CREATE}
     61  1.65     lukem 	${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
     62  1.65     lukem 	    ${CXXFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     63  1.47       mrg 	    ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \
     64  1.65     lukem 			${DESTDIR}/usr/include/g++} \
     65  1.49     lukem 	    ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     66  1.39  christos 
     67  1.53     lukem .endif # defined(SRCS)							# }
     68  1.33        tv 
     69  1.33        tv ##### Clean rules
     70  1.19   mycroft cleandepend:
     71  1.33        tv .if defined(SRCS)
     72  1.55     lukem 	rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND}
     73   1.3   mycroft .endif
     74   1.2   mycroft 
     75  1.33        tv ##### Custom rules
     76   1.2   mycroft .if !target(tags)
     77  1.33        tv tags: ${SRCS}
     78   1.4   mycroft .if defined(SRCS)
     79   1.2   mycroft 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
     80   1.2   mycroft 	    sed "s;\${.CURDIR}/;;" > tags
     81   1.4   mycroft .endif
     82   1.4   mycroft .endif
     83