1 # $NetBSD: bsd.dep.mk,v 1.79 2013/10/31 01:55:03 mrg Exp $
4 realdepend
: beforedepend .depend afterdepend
5 .ORDER
: beforedepend .depend afterdepend
7 beforedepend .depend afterdepend
: # ensure existence
10 MKDEP?
= CC
=${CC
:Q
} mkdep
11 MKDEPCXX?
= CC
=${CXX
:Q
} mkdep
15 # some of the rules involve .h sources, so remove them from mkdep line
17 .if defined
(SRCS
) && !empty
(SRCS
)
18 __acpp_flags
= ${_ASM_TRADITIONAL_CPP}
21 .for f in
${SRCS} ${DPSRCS}
22 .if
"${NODPSRCS:M${f}}" == ""
23 __DPSRCS.
all+= ${f
:C
/\.
(c|m|s|S|C|
cc|
cpp|
cxx)$/.d
/}
26 beforedepend
: ${DPSRCS}
28 __DPSRCS.
all+= ${SRCS
:C
/\.
(c|m|s|S|C|
cc|
cpp|
cxx)$/.d
/} \
29 ${DPSRCS
:C
/\.
(c|m|s|S|C|
cc|
cpp|
cxx)$/.d
/}
31 __DPSRCS.d
= ${__DPSRCS.
all:O
:u
:M
*.d
}
32 __DPSRCS.notd
= ${__DPSRCS.
all:O
:u
:N
*.d
}
35 __DPSRCS.bcd
= ${"${USE_BITCODE:Uno}" == "yes":?
${SRCS
:M
*.c
:O
:u
:.c
=.bcd
}:}
36 __DPSRCS.d
+= ${__DPSRCS.bcd
}
37 .
endif # defined(__MINIX)
39 .NOPATH
: .depend
${__DPSRCS.d
}
41 .if
!empty
(__DPSRCS.d
) # {
42 ${__DPSRCS.d
}: ${__DPSRCS.notd
} ${DPSRCS}
45 MKDEPSUFFLAGS
=-s
${MKDEP_SUFFIXES
:Q
}
47 .if defined
(MKDEPINCLUDES
) && ${MKDEPINCLUDES} != "no"
49 @echo Rebuilding dependency file
: ${.ALLSRC
}
51 @
(cd
${.CURDIR
} && ${MAKE} depend
)
53 _MKDEP_FILEFLAGS
=${MKDEPSUFFLAGS}
55 _MKDEP_MERGEFLAGS
=${MKDEPSUFFLAGS}
59 .depend
: ${__DPSRCS.d
}
62 ${MKDEP} ${_MKDEP_MERGEFLAGS} -d
-f
${.TARGET
} ${__DPSRCS.d
}
65 .SUFFIXES
: .d .s .S .c .C .
cc .
cpp .
cxx .m
67 .SUFFIXES
: .bcd .d .s .S .c .C .
cc .
cpp .
cxx .m
69 .if
${USE_BITCODE
:Uno
} == "yes"
72 ${MKDEP} -f
${.TARGET
} -s .bc
-- ${MKDEPFLAGS} \
73 ${CFLAGS
:C
/-([IDU
])[ ]*/-\
1/Wg
:M-
[IDU
]*} \
74 ${CPPFLAGS} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
}
75 .
endif # ${USE_BITCODE:Uno} == "yes"
76 .
endif # !defined(__MINIX)
80 ${MKDEP} -f
${.TARGET
}.tmp
${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
81 ${CFLAGS
:C
/-([IDU
])[ ]*/-\
1/Wg
:M-
[IDU
]*} \
82 ${CPPFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} \
83 ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} && \
84 mv
${.TARGET
}.tmp
${.TARGET
}
88 ${MKDEP} -f
${.TARGET
}.tmp
${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
89 ${OBJCFLAGS
:C
/-([IDU
])[ ]*/-\
1/Wg
:M-
[IDU
]*} \
90 ${CPPFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} \
91 ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} && \
92 mv
${.TARGET
}.tmp
${.TARGET
}
96 ${MKDEP} -f
${.TARGET
}.tmp
${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
97 ${AFLAGS
:C
/-([IDU
])[ ]*/-\
1/Wg
:M-
[IDU
]*} \
98 ${CPPFLAGS} ${AFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} \
99 ${__acpp_flags} ${.IMPSRC
} && \
100 mv
${.TARGET
}.tmp
${.TARGET
}
102 .C.d .
cc.d .
cpp.d .
cxx.d
:
104 ${MKDEPCXX} -f
${.TARGET
}.tmp
${_MKDEP_FILEFLAGS} -- ${MKDEPFLAGS} \
105 ${CXXFLAGS
:C
/-([IDU
])[ ]*/-\
1/Wg
:M-
[IDU
]*} \
106 ${CPPFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} \
107 ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} && \
108 mv
${.TARGET
}.tmp
${.TARGET
}
110 .
endif # defined(SRCS) && !empty(SRCS) # }
113 .if defined
(SRCS
) && !empty
(SRCS
)
114 CLEANDIRFILES
+= .depend
${__DPSRCS.d
} ${__DPSRCS.d
:.d
=.d.tmp
} ${.CURDIR
}/tags ${CLEANDEPEND}
120 .if defined
(SRCS
) && !empty
(SRCS
)
121 -cd
"${.CURDIR}"; ctags
-f
/dev
/stdout
${.ALLSRC
:N
*.h
} | \
122 ${TOOL_SED} "s;\${.CURDIR}/;;" > tags
126 ##### Pull in related .mk logic
127 .
include <bsd.
clean.mk
>