Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.73.2.3
      1  1.73.2.3      yamt #	$NetBSD: bsd.dep.mk,v 1.73.2.3 2014/05/22 11:37:53 yamt Exp $
      2      1.13       gwr 
      3      1.33        tv ##### Basic targets
      4      1.33        tv realdepend:	beforedepend .depend afterdepend
      5      1.33        tv .ORDER:		beforedepend .depend afterdepend
      6      1.14   mycroft 
      7      1.33        tv beforedepend .depend afterdepend: # ensure existence
      8      1.33        tv 
      9      1.33        tv ##### Default values
     10      1.63       dsl MKDEP?=			mkdep
     11  1.73.2.3      yamt MKDEPCXX?=		mkdep
     12      1.63       dsl MKDEP_SUFFIXES?=	.o
     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.73.2.2      yamt .if defined(SRCS) && !empty(SRCS)
     18      1.70     joerg __acpp_flags=	${_ASM_TRADITIONAL_CPP}
     19      1.48     lukem 
     20  1.73.2.1      yamt .if defined(NODPSRCS)
     21  1.73.2.1      yamt .for f in ${SRCS} ${DPSRCS}
     22  1.73.2.1      yamt .if "${NODPSRCS:M${f}}" == ""
     23  1.73.2.1      yamt __DPSRCS.all+=	${f:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
     24  1.73.2.1      yamt .endif
     25  1.73.2.1      yamt .endfor
     26  1.73.2.1      yamt beforedepend: ${DPSRCS}
     27  1.73.2.1      yamt .else
     28  1.73.2.1      yamt __DPSRCS.all+=	${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
     29      1.55     lukem 		${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
     30  1.73.2.1      yamt .endif
     31      1.55     lukem __DPSRCS.d=	${__DPSRCS.all:O:u:M*.d}
     32      1.55     lukem __DPSRCS.notd=	${__DPSRCS.all:O:u:N*.d}
     33      1.48     lukem 
     34      1.55     lukem .NOPATH: .depend ${__DPSRCS.d}
     35      1.53     lukem 
     36      1.56    martin .if !empty(__DPSRCS.d)							# {
     37      1.55     lukem ${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
     38      1.56    martin .endif									# }
     39      1.55     lukem 
     40  1.73.2.3      yamt MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q}
     41  1.73.2.3      yamt 
     42  1.73.2.3      yamt .if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no"
     43  1.73.2.3      yamt .STALE:
     44  1.73.2.3      yamt 	@echo Rebuilding dependency file: ${.ALLSRC}
     45  1.73.2.3      yamt 	@rm -f ${.ALLSRC}
     46  1.73.2.3      yamt 	@(cd ${.CURDIR} && ${MAKE} depend)
     47  1.73.2.3      yamt _MKDEP_MERGEFLAGS=-i
     48  1.73.2.3      yamt _MKDEP_FILEFLAGS=${MKDEPSUFFLAGS}
     49  1.73.2.3      yamt .else
     50  1.73.2.3      yamt _MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS}
     51  1.73.2.3      yamt _MKDEP_FILEFLAGS=
     52  1.73.2.3      yamt .endif
     53  1.73.2.3      yamt 
     54      1.55     lukem .depend: ${__DPSRCS.d}
     55      1.60     lukem 	${_MKTARGET_CREATE}
     56      1.58     lukem 	rm -f .depend
     57  1.73.2.3      yamt 	${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d}
     58      1.39  christos 
     59      1.57     lukem .SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
     60      1.49     lukem 
     61      1.51     lukem .c.d:
     62      1.60     lukem 	${_MKTARGET_CREATE}
     63  1.73.2.3      yamt 	${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
     64      1.65     lukem 	    ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     65  1.73.2.3      yamt 	    ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \
     66  1.73.2.3      yamt 	    ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \
     67  1.73.2.3      yamt 	    mv ${.TARGET}.tmp ${.TARGET}
     68      1.39  christos 
     69      1.51     lukem .m.d:
     70      1.60     lukem 	${_MKTARGET_CREATE}
     71  1.73.2.3      yamt 	${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
     72      1.65     lukem 	    ${OBJCFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     73  1.73.2.3      yamt 	    ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \
     74  1.73.2.3      yamt 	    ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \
     75  1.73.2.3      yamt 	    mv ${.TARGET}.tmp ${.TARGET}
     76      1.39  christos 
     77      1.51     lukem .s.d .S.d:
     78      1.60     lukem 	${_MKTARGET_CREATE}
     79  1.73.2.3      yamt 	${MKDEP} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
     80      1.65     lukem 	    ${AFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     81  1.73.2.3      yamt 	    ${CPPFLAGS} ${AFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} \
     82  1.73.2.3      yamt 	    ${__acpp_flags} ${.IMPSRC} && \
     83  1.73.2.3      yamt 	    mv ${.TARGET}.tmp ${.TARGET}
     84      1.39  christos 
     85      1.51     lukem .C.d .cc.d .cpp.d .cxx.d:
     86      1.60     lukem 	${_MKTARGET_CREATE}
     87  1.73.2.3      yamt 	${MKDEPCXX} -f ${.TARGET}.tmp ${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
     88      1.65     lukem 	    ${CXXFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
     89  1.73.2.3      yamt 	    ${CPPFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \
     90  1.73.2.3      yamt 	    ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \
     91  1.73.2.3      yamt 	    mv ${.TARGET}.tmp ${.TARGET}
     92      1.39  christos 
     93  1.73.2.2      yamt .endif # defined(SRCS) && !empty(SRCS)					# }
     94      1.33        tv 
     95      1.33        tv ##### Clean rules
     96  1.73.2.2      yamt .if defined(SRCS) && !empty(SRCS)
     97  1.73.2.3      yamt CLEANDIRFILES+= .depend ${__DPSRCS.d} ${__DPSRCS.d:.d=.d.tmp} ${.CURDIR}/tags ${CLEANDEPEND}
     98       1.3   mycroft .endif
     99       1.2   mycroft 
    100      1.33        tv ##### Custom rules
    101       1.2   mycroft .if !target(tags)
    102      1.33        tv tags: ${SRCS}
    103  1.73.2.2      yamt .if defined(SRCS) && !empty(SRCS)
    104  1.73.2.3      yamt 	${_MKTARGET_CREATE}
    105      1.69  christos 	-cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
    106      1.68       apb 	    ${TOOL_SED} "s;\${.CURDIR}/;;" > tags
    107       1.4   mycroft .endif
    108       1.4   mycroft .endif
    109      1.73       apb 
    110      1.73       apb ##### Pull in related .mk logic
    111      1.73       apb .include <bsd.clean.mk>
    112