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