* [iptables PATCH] Makefile: Support 'make tags' and 'make cscope'
@ 2023-08-01 16:55 Phil Sutter
2023-08-03 14:26 ` Phil Sutter
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2023-08-01 16:55 UTC (permalink / raw)
To: netfilter-devel
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@nwl.cc>
---
.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [iptables PATCH] Makefile: Support 'make tags' and 'make cscope'
2023-08-01 16:55 [iptables PATCH] Makefile: Support 'make tags' and 'make cscope' Phil Sutter
@ 2023-08-03 14:26 ` Phil Sutter
0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2023-08-03 14:26 UTC (permalink / raw)
To: netfilter-devel
On Tue, Aug 01, 2023 at 06:55:10PM +0200, Phil Sutter wrote:
> 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.
This one sucks: 'make tags' won't cover headers in include/iptables and
include/linux because Makefile.am merely lists the directories in
EXTRA_DIST.
Since automake does not support anything involving wildcards, I see only
two options moving forward:
A) List the individual files in EXTRA_DIST instead of the directories
B) Replace Makefile.am by (yet another) GNUmakefile.in
While (A) means updating Makefile.am whenever a new linux header is
being cached, (B) is going into the false direction in my opinion.
Better ideas are appreciated, of course. :)
Cheers, Phil
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-03 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 16:55 [iptables PATCH] Makefile: Support 'make tags' and 'make cscope' Phil Sutter
2023-08-03 14:26 ` Phil Sutter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).