On 08/09/2012 07:32 PM, Stefano Lattarini wrote: > * lib/am/tags.am (am__uniquify_input, am__define_uniq_tagged_files): > Remove, their role taken over by ... > (am.tags.files.uniq): ... this new (memoized) variable. > All rules adjusted. > (tags-am): Use $(CURDIR) instead of `pwd` to compute the absolute > path of the current working directory. > (GTAGS): Use $(abs_top_builddir) instead of `cd $(top_builddir) && pwd` > to compute the absolute path of the top-level build directory. > > Signed-off-by: Stefano Lattarini <[email protected]> > Actually, the first take of this patch was busted (as found out by the first attached patch). Consider this patch superseded by the second attached one.
Sorry for the noise, Stefano
>From ce3012d4177e688f0dacfff20e3abceb51626911 Mon Sep 17 00:00:00 2001 Message-Id: <ce3012d4177e688f0dacfff20e3abceb51626911.1344548782.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <[email protected]> Date: Thu, 9 Aug 2012 22:18:28 +0200 Subject: [PATCH 1/2] [ng] tags: enhance testsuite coverage for etags/ctags * t/tagsub.sh: Here. Signed-off-by: Stefano Lattarini <[email protected]> --- t/tagsub.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/t/tagsub.sh b/t/tagsub.sh index 9103805..c8a6e90 100755 --- a/t/tagsub.sh +++ b/t/tagsub.sh @@ -21,28 +21,73 @@ required=etags . ./defs || exit 1 cat >> configure.ac << 'END' -AC_CONFIG_FILES([sub/Makefile]) +AC_SUBST([CC], [false]) +AM_CONDITIONAL([CONF_FALSE], [false]) +AC_CONFIG_FILES([sub1/Makefile]) +AC_CONFIG_FILES([sub2/Makefile]) +AC_CONFIG_FILES([sub2/subsub/Makefile]) +AC_CONFIG_FILES([sub3/Makefile]) AC_OUTPUT END -echo 'SUBDIRS = sub' > Makefile.am -mkdir sub -echo 'noinst_HEADERS = iguana.h' > sub/Makefile.am -: > sub/iguana.h +mkdir sub1 sub2 sub3 sub2/subsub + +cat > Makefile.am << 'END' +SUBDIRS = sub1 sub2 sub3 +test-tags: tags + cat sub1/TAGS + cat sub2/TAGS + cat sub2/subsub/TAGS + test ! -f sub3/TAGS + grep 'sub1/TAGS' TAGS + grep 'sub2/TAGS' TAGS + grep 'sub3/TAGS' TAGS && exit 1; : + grep 'iguana\.c' sub1/TAGS + grep 'subsub/TAGS' sub2/TAGS + grep 'subsub/foo\.h' sub2/TAGS + grep 'bar\.baz' sub2/subsub/TAGS + grep 'foo\.off' sub2/subsub/TAGS + grep 'foo\.h' sub2/subsub/TAGS && exit 1; : +check-local: test-tags +END + +cat > sub1/Makefile.am << 'END' +if COND_FALSE +bin_PROGRAMS = iguana +endif +END +echo 'int main () { return choke_me (); }' > sub1/iguana.c + +cat > sub2/Makefile.am << 'END' +SUBDIRS = subsub . +noinst_HEADERS = subsub/foo.h +subsub/foo.h: + echo dummy >$@ +CLEANFILES = $(noinst_HEADERS) +END + +cat > sub2/subsub/Makefile.am << 'END' +EXTRA_DIST = bar.baz +nodist_noinst_DATA = foo.off +TAGS_FILES = $(EXTRA_DIST) $(nodist_noinst_DATA) +MOSTLYCLEANFILES = $(nodist_noinst_DATA) +foo.off: + echo $@ >$@ +END +: > sub2/subsub/bar.baz + +# No file to tag here, deliberately. +: > sub3/Makefile.am $ACLOCAL $AUTOCONF -$AUTOMAKE +$AUTOMAKE -i ./configure -$MAKE tags -test -f sub/TAGS -test -f TAGS -$FGREP sub/TAGS TAGS -$FGREP iguana.h sub/TAGS +$MAKE test-tags +$MAKE distcheck $MAKE distclean -test ! -e sub/TAGS -test ! -e TAGS +find . -name TAGS | grep . && exit 1 : -- 1.7.12.rc0
>From 86538e96debf8a4927ad3b4c28d6e0212e2b809b Mon Sep 17 00:00:00 2001 Message-Id: <86538e96debf8a4927ad3b4c28d6e0212e2b809b.1344548782.git.stefano.lattar...@gmail.com> In-Reply-To: <ce3012d4177e688f0dacfff20e3abceb51626911.1344548782.git.stefano.lattar...@gmail.com> References: <ce3012d4177e688f0dacfff20e3abceb51626911.1344548782.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <[email protected]> Date: Thu, 9 Aug 2012 19:31:35 +0200 Subject: [PATCH 2/2] [ng] tags: use more GNU make features * lib/am/tags.am (am__uniquify_input, am__define_uniq_tagged_files): Remove, their role taken over by ... (am.tags.files.uniq): ... this new (memoized) variable. All rules adjusted. (tags-am): Use $(CURDIR) instead of `pwd` to compute the absolute path of the current working directory. (GTAGS): Use $(abs_top_builddir) instead of `cd $(top_builddir) && pwd` to compute the absolute path of the top-level build directory. Signed-off-by: Stefano Lattarini <[email protected]> --- lib/am/tags.am | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/lib/am/tags.am b/lib/am/tags.am index 368911d..8807807 100644 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@ -14,31 +14,19 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see <http://www.gnu.org/licenses/>. -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' - -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am.tags.files)'; \ - unique=`for i in $$list; do \ -## Handle VPATH correctly. - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` +# Use $(sort) rather than $(am.util.uniq) here, because the former is +# faster on long lists, and we don't care about the order of the list +# anyway. +am.tags.files.unique = \ + $(call am.memoize,am.tags.files.unique,$(sort \ + $(foreach f,$(am.tags.files),$(call am.vpath.rewrite,$f)))) ## ---- ## ## ID. ## ## ---- ## ID: $(am.tags.files) - $(am__define_uniq_tagged_files); mkid -fID $$unique + mkid -fID $(am.tags.files.unique) ## ------ ## @@ -60,7 +48,6 @@ tags-am: $(TAGS_DEPENDENCIES) $(am.tags.files) ## We use the positional parameters to build the subdir list with ## absolute names, without the need to worry about white space in `pwd`. set x; \ - here=`pwd`; \ ## Exuberant Ctags wants --etags-include, ## GNU Etags --include ## Furthermore Exuberant Ctags 5.5.4 fails to create TAGS files @@ -78,13 +65,13 @@ tags-am: $(TAGS_DEPENDENCIES) $(am.tags.files) ?SUBDIRS? if test "$$subdir" = .; then :; else \ ?SUBDIRS? test ! -f $$subdir/TAGS || \ ## Note that the = is mandatory for --etags-include. -?SUBDIRS? set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ +?SUBDIRS? set "$$@" "$$include_option=$(CURDIR)/$$subdir/TAGS"; \ ?SUBDIRS? fi; \ ?SUBDIRS? done; \ - $(am__define_uniq_tagged_files); \ ## Remove the 'x' we added first: shift; \ ## Make sure we have something to run etags on. + unique='$(am.tags.files.unique)'; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ @@ -113,11 +100,10 @@ endif !%?SUBDIRS% CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am.tags.files) - $(am__define_uniq_tagged_files); \ ## Make sure we have something to run ctags on. - test -z "$(CTAGS_ARGS)$$unique" \ + test -z "$(CTAGS_ARGS)$(am.tags.files.unique)" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique + $(am.tags.files.unique) ## --------------- ## @@ -126,9 +112,7 @@ ctags-am: $(TAGS_DEPENDENCIES) $(am.tags.files) .PHONY: GTAGS GTAGS: - here=`cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" + cd $(top_srcdir) && gtags -i $(GTAGS_ARGS) '$(abs_top_builddir)' ## ------- ## -- 1.7.12.rc0
