cscope.mk revision 1.1 1 # $NetBSD: cscope.mk,v 1.1 2015/08/29 16:27:07 uebayasi Exp $
2
3 ##
4 ## cscope
5 ##
6
7 EXTRA_CLEAN+= cscope.out cscope.tmp
8 .if !target(cscope.out)
9 cscope.out: Makefile depend
10 ${_MKTARGET_CREATE}
11 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend \
12 | tr -s ' ' '\n' \
13 | ${TOOL_SED} ';s|^../../||;' \
14 > cscope.tmp
15 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend \
16 | tr -s ' ' '\n' \
17 | ${TOOL_SED} 's|^../../||;' \
18 >> cscope.tmp
19 @echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \
20 ${CSCOPE} -k -i - -b `echo ${INCLUDES} | ${TOOL_SED} s/-nostdinc//`
21 # cscope doesn't write cscope.out if it's uptodate, so ensure
22 # make doesn't keep calling cscope when not needed.
23 @rm -f cscope.tmp; touch cscope.out
24 .endif
25
26 .if !target(cscope)
27 cscope: cscope.out
28 @${CSCOPE} -d
29 .endif
30
31 EXTRA_CLEAN+= ID
32 .if !target(mkid)
33 .PHONY: mkid
34 mkid: ID
35
36 ID: Makefile depend
37 ${_MKTARGET_CREATE}
38 @${MKID} \
39 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
40 lib/kern/.depend lib/compat/.depend \
41 | tr ' ' '\n' \
42 | ${TOOL_SED} "s|^../../||" \
43 | sort -u` \
44 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
45 .depend \
46 | tr ' ' '\n' \
47 | sort -u`
48
49 .endif
50