Skip to contentSkip to conversation

Makefile: Generate tag files under $SRC_PATH

PATCH Applied Fam Zheng 3 participants 6 messages May 22, 2015 – Jun 17, 2015 Kbuild

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

v2 cover Makefile: Generate tag files under $SRC_PATH

Fam Zheng (2):
Makefile: Fix "make cscope TAGS"
Makefile: Add "make ctags"

 Makefile | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
Signature · 1 line
2.4.1
author
#1 lore raw

PATCH v2 1/2 Makefile: Fix "make cscope TAGS"

Cscope and TAGS files work in source directory rather than the build directory, also, don't ask users to run configure first, because they may have an out of tree build.

---
 Makefile | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
Makefile +10 -5
index d945804..d4515fa 100644
@@ -3,6 +3,11 @@
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
 
+# Before including a proper config-host.mak, assume we are in the source tree
+SRC_PATH=.
+
+UNCHECKED_GOALS := %clean TAGS cscope
+
 # All following code might depend on configuration variables
 ifneq ($(wildcard config-host.mak),)
 # Put the all: rule here so that config-host.mak can contain dependencies.
@@ -38,7 +43,7 @@ config-host.mak: $(SRC_PATH)/configure
 	fi
 else
 config-host.mak:
-ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
+ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
 	@echo "Please call configure before running make!"
 	@exit 1
 endif
@@ -438,9 +443,9 @@ TAGS:
 	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
 
 cscope:
-	rm -f ./cscope.*
-	find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
-	cscope -b
+	rm -f "$(SRC_PATH)"/cscope.*
+	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
+	cscope -b -i"$(SRC_PATH)/cscope.files"
 
 # opengl shader programs
 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
@@ -583,7 +588,7 @@ endif # CONFIG_WIN
 
 # Add a dependency on the generated files, so that they are always
 # rebuilt before other object files
-ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
+ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
 Makefile: $(GENERATED_HEADERS)
 endif
 
Signature · 1 line
2.4.1
author
#2 lore raw

PATCH v2 2/2 Makefile: Add "make ctags"

In reply to Fam Zheng

This generates ctags file

---
 Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Makefile +6 -1
index d4515fa..f2efe71 100644
@@ -6,7 +6,7 @@ BUILD_DIR=$(CURDIR)
 # Before including a proper config-host.mak, assume we are in the source tree
 SRC_PATH=.
 
-UNCHECKED_GOALS := %clean TAGS cscope
+UNCHECKED_GOALS := %clean TAGS cscope ctags
 
 # All following code might depend on configuration variables
 ifneq ($(wildcard config-host.mak),)
@@ -437,6 +437,11 @@ endif
 test speed: all
 	$(MAKE) -C tests/tcg $@
 
+.PHONY: ctags
+ctags:
+	rm -f $@
+	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
+
 .PHONY: TAGS
 TAGS:
 	rm -f $@
Signature · 1 line
2.4.1
author
#3 lore raw
In reply to Fam Zheng

On Fri, 05/22 13:35, Fam Zheng wrote:

Ping :)

Fam

Quoted 13 lines

Fam Zheng (2):
Makefile: Fix "make cscope TAGS"
Makefile: Add "make ctags"

 Makefile | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
Signature · 1 line
2.4.1
Reviewed-by
#4 lore raw
Quoted 20 lines · Fam Zheng

On Fri, 05/22 13:35, Fam Zheng wrote:

Ping :)

Fam

Quoted 13 lines

Fam Zheng (2):
Makefile: Fix "make cscope TAGS"
Makefile: Add "make ctags"

 Makefile | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
Signature · 1 line
2.4.1

Looks good to me -- this has long been a major annoyance of mine when I want to review code (and zip around) without trying to configure it first.