tools/llvm: Do not build with symbols
[minix3.git] / share / mk / bsd.dep.mk
blobbff90b066aca7a72ce91e674c435aa71b2a977b8
1 # $NetBSD: bsd.dep.mk,v 1.79 2013/10/31 01:55:03 mrg Exp $
3 ##### Basic targets
4 realdepend: beforedepend .depend afterdepend
5 .ORDER: beforedepend .depend afterdepend
7 beforedepend .depend afterdepend: # ensure existence
9 ##### Default values
10 MKDEP?= CC=${CC:Q} mkdep
11 MKDEPCXX?= CC=${CXX:Q} mkdep
12 MKDEP_SUFFIXES?= .o
14 ##### Build rules
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}
20 .if defined(NODPSRCS)
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/}
24 .endif
25 .endfor
26 beforedepend: ${DPSRCS}
27 .else
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/}
30 .endif
31 __DPSRCS.d= ${__DPSRCS.all:O:u:M*.d}
32 __DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d}
34 .if defined(__MINIX)
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}
43 .endif # }
45 MKDEPSUFFLAGS=-s ${MKDEP_SUFFIXES:Q}
47 .if defined(MKDEPINCLUDES) && ${MKDEPINCLUDES} != "no"
48 .STALE:
49 @echo Rebuilding dependency file: ${.ALLSRC}
50 @rm -f ${.ALLSRC}
51 @(cd ${.CURDIR} && ${MAKE} depend)
52 _MKDEP_MERGEFLAGS=-i
53 _MKDEP_FILEFLAGS=${MKDEPSUFFLAGS}
54 .else
55 _MKDEP_MERGEFLAGS=${MKDEPSUFFLAGS}
56 _MKDEP_FILEFLAGS=
57 .endif
59 .depend: ${__DPSRCS.d}
60 ${_MKTARGET_CREATE}
61 rm -f .depend
62 ${MKDEP} ${_MKDEP_MERGEFLAGS} -d -f ${.TARGET} ${__DPSRCS.d}
64 .if !defined(__MINIX)
65 .SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
66 .else
67 .SUFFIXES: .bcd .d .s .S .c .C .cc .cpp .cxx .m
69 .if ${USE_BITCODE:Uno} == "yes"
70 .c.bcd:
71 ${_MKTARGET_CREATE}
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)
78 .c.d:
79 ${_MKTARGET_CREATE}
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}
86 .m.d:
87 ${_MKTARGET_CREATE}
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}
94 .s.d .S.d:
95 ${_MKTARGET_CREATE}
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:
103 ${_MKTARGET_CREATE}
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) # }
112 ##### Clean rules
113 .if defined(SRCS) && !empty(SRCS)
114 CLEANDIRFILES+= .depend ${__DPSRCS.d} ${__DPSRCS.d:.d=.d.tmp} ${.CURDIR}/tags ${CLEANDEPEND}
115 .endif
117 ##### Custom rules
118 .if !target(tags)
119 tags: ${SRCS}
120 .if defined(SRCS) && !empty(SRCS)
121 -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
122 ${TOOL_SED} "s;\${.CURDIR}/;;" > tags
123 .endif
124 .endif
126 ##### Pull in related .mk logic
127 .include <bsd.clean.mk>