[iptables PATCH] Makefile: Support 'make tags' and 'make cscope'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Copy necessary bits from generated Makefile.in into the static
extensions/GNUmakefile.in so it plays nicely when called.

For some reason, using 'make ctags' creates a top-level tags file which
does not include others, so not quite useful. Using 'make tags' instead
works, but only after I created an etags-wrapper (calling ctags -e) in
my ~/bin. Seems as per design, though.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 .gitignore                |  3 ++
 extensions/GNUmakefile.in | 66 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index ec4e44cad8aa7..d1b1fd9ad863c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,9 @@ Makefile.in
 *.swp
 
 /tags
+TAGS
+/cscope.files
+/cscope.out
 
 # make check results
 /test-suite.log
diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in
index e289adf06547f..37e6b271a808a 100644
--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -79,7 +79,8 @@ targets_install :=
 
 .SECONDARY:
 
-.PHONY: all install uninstall clean distclean FORCE dvi check installcheck
+.PHONY: all install uninstall clean distclean FORCE dvi check installcheck \
+	CTAGS GTAGS TAGS ctags tags cscopelist
 
 all: ${targets}
 
@@ -110,7 +111,7 @@ install: ${targets_install} ${symlinks_install}
 	rm -f initext.c initext4.c initext6.c initextb.c initexta.c
 	rm -f .*.d .*.dd;
 
-distclean: clean
+distclean: clean distclean-tags
 
 init%.o: init%.c
 	${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<;
@@ -249,3 +250,64 @@ dist_sources = $(filter-out ${dist_initext_src},$(wildcard $(srcdir)/*.[ch]))
 dvi:
 check: all
 installcheck:
+
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+ETAGS = @ETAGS@
+
+am__tagged_files = ${dist_sources}
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
+
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+
+TAGS: tags
+tags: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	set x; \
+	here=`pwd`; \
+	$(am__define_uniq_tagged_files); \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+
+CTAGS: ctags
+ctags: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+subdir = extensions
+cscopelist: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-- 
2.40.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux