xref: /freebsd/share/mk/bsd.dep.mk (revision 05c7a37afb48ddd5ee1bd921a5d46fe59cc70b15)
1#	$Id: bsd.dep.mk,v 1.5 1996/03/31 20:04:08 wosch Exp $
2
3MKDEPCMD?=	mkdep
4DEPENDFILE?=	.depend
5
6# some of the rules involve .h sources, so remove them from mkdep line
7.if !target(depend)
8depend: beforedepend ${DEPENDFILE} afterdepend ${_DEPSUBDIR}
9.if defined(SRCS)
10
11# .if defined ${SRCS:M*.[sS]} does not work
12__depend_s=	${SRCS:M*.[sS]}
13__depend_c=	${SRCS:M*.c}
14__depend_cc=	${SRCS:M*.cc} ${SRCS:M*.C} ${SRCS:M*.cxx}
15
16${DEPENDFILE}: ${SRCS}
17	rm -f ${DEPENDFILE}
18.if defined(__depend_s) && !empty(__depend_s)
19	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} ${CFLAGS:M-[ID]*} ${AINC} \
20		${.ALLSRC:M*.[sS]}
21.endif
22.if defined(__depend_c) && !empty(__depend_c)
23	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} ${CFLAGS:M-[ID]*} \
24		${.ALLSRC:M*.c}
25.endif
26.if defined(__depend_cc) && !empty(__depend_cc)
27	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
28		${CXXFLAGS:M-nostd*} ${CXXFLAGS:M-[ID]*} \
29		${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}
30.endif
31
32.else
33${DEPENDFILE}: ${_DEPSUBDIR}
34.endif
35.if !target(beforedepend)
36beforedepend:
37.endif
38.if !target(afterdepend)
39afterdepend:
40.endif
41.endif
42
43.if !target(tags)
44.if defined(SRCS)
45tags: ${SRCS}
46	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
47	    sed "s;\${.CURDIR}/;;" > tags
48.else
49tags:
50.endif
51.endif
52
53.if defined(SRCS)
54clean:
55cleandir: cleandepend
56cleandepend:
57	rm -f ${DEPENDFILE} ${.CURDIR}/tags
58.endif
59