Skip to content

Commit a5124f6

Browse files
committed
smk: add cscope and ctags support
1 parent aa568cc commit a5124f6

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@
2121

2222
# cscope
2323
cscope.*
24+
25+
# ctags
26+
TAGS

smk/s.mk

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ $(error "Non-supported language $(smk_lang)")
2828
endif
2929
endif
3030

31+
# Include cscope and ctags support
32+
include $(smk_dir)/tags.mk
33+
3134
# Provide smk functions
3235
define smk_binary
3336
$(1)_bin := bin/$(1)

smk/tags.mk

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ctags: TAGS
2+
cscope: cscope.out
3+
.PHONY: ctags cscope
4+
5+
6+
TAGS: cscope.files
7+
$(call cmd,"TAGS","",etags, cscope.files)
8+
9+
cscope.out: cscope.files
10+
$(call cmd,"CSCOPE","",cscope, -b -q -k)
11+
12+
cscope.files:
13+
$(call cmd,"FIND",".*\.[h|hh|c|cc]",find, . -regex ".*\.[h|hh|c|cc]" > $@)
14+
15+
16+
ctags_distclean:
17+
$(call clean,"TAGS",TAGS)
18+
19+
distclean: ctags_distclean
20+
.PHONY: ctags_distclean
21+
22+
cscope_clean:
23+
$(call clean,"cscope.*",cscope.files cscope.in.out cscope.po.out)
24+
25+
clean: cscope_clean
26+
.PHONY: cscope_clean
27+
28+
cscope_distclean:
29+
$(call clean,"cscope.out",cscope.out)
30+
31+
distclean: cscope_distclean
32+
.PHONY: cscope_distclean

0 commit comments

Comments
 (0)