Expand PMF_FN_* macros.
[netbsd-mini2440.git] / share / mk / bsd.dep.mk
blob3d88775adbcfe6e789458c125c5ce06ae7996745
1 # $NetBSD: bsd.dep.mk,v 1.67 2004/04/18 04:34:27 lukem Exp $
3 ##### Basic targets
4 cleandir: cleandepend
5 realdepend: beforedepend .depend afterdepend
6 .ORDER: beforedepend .depend afterdepend
8 beforedepend .depend afterdepend: # ensure existence
10 ##### Default values
11 MKDEP?= 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) # {
18 _TRADITIONAL_CPP?=-traditional-cpp
19 __acpp_flags= ${_TRADITIONAL_CPP}
21 __DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
22 ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
23 __DPSRCS.d= ${__DPSRCS.all:O:u:M*.d}
24 __DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d}
26 .NOPATH: .depend ${__DPSRCS.d}
28 .if !empty(__DPSRCS.d) # {
29 ${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
30 .endif # }
32 .depend: ${__DPSRCS.d}
33 ${_MKTARGET_CREATE}
34 rm -f .depend
35 ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d}
37 .SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
39 .c.d:
40 ${_MKTARGET_CREATE}
41 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
42 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
43 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
45 .m.d:
46 ${_MKTARGET_CREATE}
47 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
48 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
49 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
51 .s.d .S.d:
52 ${_MKTARGET_CREATE}
53 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
54 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
55 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC}
57 .C.d .cc.d .cpp.d .cxx.d:
58 ${_MKTARGET_CREATE}
59 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
60 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
61 ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \
62 ${DESTDIR}/usr/include/g++} \
63 ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
65 .endif # defined(SRCS) # }
67 ##### Clean rules
68 cleandepend: .PHONY
69 .if defined(SRCS)
70 rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND}
71 .endif
73 ##### Custom rules
74 .if !target(tags)
75 tags: ${SRCS}
76 .if defined(SRCS)
77 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
78 ${TOOL_SED} "s;\${.CURDIR}/;;" > tags
79 .endif
80 .endif