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