Skip to contentSkip to conversation

makefile: Add a cscope target

PATCH In review Kristof Provost 3 participants 5 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 makefile: Add a cscope target

The current makefile supports ctags but not cscope. Some people prefer cscope (I do), so this patch adds a cscope target.

---

Makefile +6 -2
index 8db4dbe..42c9e94 100644
@@ -947,6 +947,10 @@ tags:
 	$(RM) tags
 	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
 
+cscope:
+	$(RM) cscope*
+	$(FIND) . -name '*.hcS]' -print | xargs cscope -b
+
 ### Detect prefix changes
 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
              $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
@@ -1093,7 +1097,7 @@ clean:
 		$(LIB_FILE) $(XDIFF_LIB)
 	$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
-	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
+	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
 	$(RM) -r autom4te.cache
 	$(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
@@ -1111,7 +1115,7 @@ endif
 	$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
 
 .PHONY: all install clean strip
-.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS
+.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS 
 
 ### Check documentation
 #

--
Kristof

#1 lore raw

Makefile tags: · line 952

Quoted 3 lines · Kristof Provost
Makefile +3 -0
+cscope:
+	$(RM) cscope*
+	$(FIND) . -name '*.hcS]' -print | xargs cscope -b

missing [

Gruesse,

Signature · 2 lines
Frank Lichtenheld <[email protected]>
www: http://www.djpig.de/
#2 lore raw
Quoted 7 lines · Frank Lichtenheld

Review

Quoted 3 lines · Kristof Provost
(quoted diff) +3 -0
+cscope:
+	$(RM) cscope*
+	$(FIND) . -name '*.hcS]' -print | xargs cscope -b

missing [

Well, that will teach me to post patches after midnight.

Here's a fixed version. I've also added cscope* to the .gitignore file. For some reason tags and TAGS weren't in there either so I've added them too.

---

.gitignore +3 -0
index e0b91be..62afef2 100644
@@ -171,3 +171,6 @@ config.status
 config.mak.autogen
 config.mak.append
 configure
+tags
+TAGS
+cscope*
Makefile +6 -2
index 8db4dbe..e2790c8 100644
@@ -947,6 +947,10 @@ tags:
 	$(RM) tags
 	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
 
+cscope:
+	$(RM) cscope*
+	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
+
 ### Detect prefix changes
 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
              $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
@@ -1093,7 +1097,7 @@ clean:
 		$(LIB_FILE) $(XDIFF_LIB)
 	$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
-	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
+	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
 	$(RM) -r autom4te.cache
 	$(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
@@ -1111,7 +1115,7 @@ endif
 	$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
 
 .PHONY: all install clean strip
-.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS
+.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS 
 
 ### Check documentation
 #

--
Kristof

#3 lore raw

PATCH 1/1 makefile: Add a cscope target

The current makefile supports ctags but not cscope. Some people prefer cscope (I do), so this patch adds a cscope target.

---
This version of the patch includes the fix for the missing [ Frank spotted, and adds 'cscope*' to the .gitignore list as Alex suggested. While I did that I noticed that 'tags' and 'TAGS' were also missing.

It's also in the (hopefully) right format. Thank to Johannes Schindelin for pointing out my mistakes.

 .gitignore |    3 +++
 Makefile   |    8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
.gitignore +3 -0
index e0b91be..62afef2 100644
@@ -171,3 +171,6 @@ config.status
 config.mak.autogen
 config.mak.append
 configure
+tags
+TAGS
+cscope*
Makefile +6 -2
index 8db4dbe..e2790c8 100644
@@ -947,6 +947,10 @@ tags:
 	$(RM) tags
 	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
 
+cscope:
+	$(RM) cscope*
+	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
+
 ### Detect prefix changes
 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
              $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
@@ -1093,7 +1097,7 @@ clean:
 		$(LIB_FILE) $(XDIFF_LIB)
 	$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
-	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
+	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
 	$(RM) -r autom4te.cache
 	$(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
@@ -1111,7 +1115,7 @@ endif
 	$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
 
 .PHONY: all install clean strip
-.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS
+.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS 
 
 ### Check documentation
 #
Signature · 1 line
1.5.3.4.207.g1aae
#4 lore raw
In reply to Kristof Provost

Kristof Provost, Sat, Oct 06, 2007 00:33:36 +0200:

Makefile tags: · line 951

Quoted 2 lines
Makefile +2 -0
+cscope:
+	$(RM) cscope*

You may want to add the cscope* to .gitignore