'pkgdata', 'lisp', 'noinst', 'check');
}
-# Handle TAGS.
-sub handle_tags
-{
- define_variable ('am.tags.files', INTERNAL,
- qw/$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
- $(am.config-hdr.local.in)/);
-
- if (rvar('am.tags.files')->value_as_list_recursive
- || var ('ETAGS_ARGS') || var ('SUBDIRS'))
- {
- $output_rules .= &file_contents ('tags', new Automake::Location);
- set_seen 'TAGS_DEPENDENCIES';
- }
- else
- {
- reject_var ('TAGS_DEPENDENCIES',
- "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
- . " without\nsources or 'ETAGS_ARGS'");
- # Every Makefile must define some sort of TAGS rule.
- # Otherwise, it would be possible for a top-level "make TAGS"
- # to fail because some subdirectory failed. Ditto ctags and
- # cscope.
- $output_rules .=
- "tags TAGS:\n\n" .
- "ctags CTAGS:\n\n" .
- "cscope cscopelist:\n\n";
- }
-}
-
-
# user_phony_rule ($NAME)
# -----------------------
# Return false if rule $NAME does not exist. Otherwise,
handle_man_pages;
handle_data;
handle_headers;
+ verbatim ('tags');
handle_subdirs;
handle_user_recursion;
- handle_tags;
handle_minor_options;
# Must come after invocation of handle_programs, handle_libraries and
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Every Makefile must define some sort of TAGS rule. Otherwise, it
+# would be possible for a top-level "make TAGS" to fail because some
+# subdirectory failed. Ditto for ctags and cscope.
+.PHONY: tags TAGS ctags CTAGS cscope cscopelist
+
+am.tags.files = \
+ $(call am.memoize,am.tags.files,$(strip \
+ $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) $(am.config-hdr.local.in)))
+
+# Let's see if we have to actually deal with tags creation.
+ifneq ($(or $(am.tags.files),$(ETAGS_ARGS),$(SUBDIRS)),)
+
+# ---------------------------------- #
+# Tags-related internal variables. #
+# ---------------------------------- #
+
# 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.
$(call am.memoize,am.tags.subfiles,$(strip \
$(foreach d,$(filter-out .,$(SUBDIRS)),$(wildcard $d/TAGS))))
-## ---- ##
-## ID. ##
-## ---- ##
+
+# ---------------------------------- #
+# ID database (from GNU id-utils). #
+# ---------------------------------- #
ID: $(am.tags.files)
mkid -fID $(am.tags.files.unique)
+am.clean.dist.f += ID
-## ------ ##
-## TAGS. ##
-## ------ ##
+# -------------------------------- #
+# GNU Etags and Exuberant ctags. #
+# -------------------------------- #
+CTAGS = ctags
ETAGS = etags
-.PHONY: TAGS tags
-if %?SUBDIRS%
-AM_RECURSIVE_TARGETS += TAGS
-RECURSIVE_TARGETS += tags-recursive
+
+ifdef SUBDIRS
+AM_RECURSIVE_TARGETS += TAGS CTAGS
+RECURSIVE_TARGETS += tags-recursive ctags-recursive
+ctags: ctags-recursive
tags: tags-recursive
-else !%?SUBDIRS%
+else
tags: tags-am
-endif !%?SUBDIRS%
+ctags: ctags-am
+endif
+
TAGS: tags
+CTAGS: ctags
+.PHONY: TAGS tags CTAGS ctags
tags-am: $(TAGS_DEPENDENCIES) $(am.tags.files)
-## Make sure we have something to run etags on.
- test -z '$(ETAGS_ARGS)$(am.tags.subfiles)$(am.tags.files.unique)' || { \
- $(ETAGS) \
- $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $(foreach f,$(am.tags.subfiles),'$(am.tags.include-option)=$(CURDIR)/$f') \
- $(am.tags.files.unique); \
- }
-
+ifneq ($(or $(ETAGS_ARGS),$(am.tags.subfiles),$(am.tags.files.unique)),)
+ $(ETAGS) \
+ $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $(foreach f,$(am.tags.subfiles),'$(am.tags.include-option)=$(CURDIR)/$f') \
+ $(am.tags.files.unique)
+endif
-## --------------- ##
-## vi-style tags. ##
-## --------------- ##
-
-CTAGS = ctags
-.PHONY: CTAGS ctags
-if %?SUBDIRS%
-AM_RECURSIVE_TARGETS += CTAGS
-RECURSIVE_TARGETS += ctags-recursive
-ctags: ctags-recursive
-else !%?SUBDIRS%
-ctags: ctags-am
-endif !%?SUBDIRS%
-
-CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am.tags.files)
-## Make sure we have something to run ctags on.
- test -z "$(CTAGS_ARGS)$(am.tags.files.unique)" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $(am.tags.files.unique)
+ifneq ($(or $(CTAGS_ARGS),$(am.tags.files.unique)),)
+ $(CTAGS) \
+ $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $(am.tags.files.unique)
+endif
+am.clean.dist.f += TAGS tags
-## --------------- ##
-## "Global tags". ##
-## --------------- ##
+
+# -------------------- #
+# GNU "Global tags". #
+# -------------------- #
.PHONY: GTAGS
GTAGS:
cd $(top_srcdir) && gtags -i $(GTAGS_ARGS) '$(abs_top_builddir)'
+am.clean.dist.f += GTAGS GRTAGS GSYMS
-## ------- ##
-## cscope ##
-## ------- ##
+# --------- #
+# Cscope. #
+# --------- #
-if %?TOPDIR_P%
+ifdef am.conf.is-topdir
CSCOPE = cscope
.PHONY: cscope clean-cscope
AM_RECURSIVE_TARGETS += cscope
clean-cscope:
rm -f cscope.files
cscope.files: clean-cscope cscopelist
-endif %?TOPDIR_P%
+am.clean.dist.f += cscope.out cscope.in.out cscope.po.out cscope.files
+endif
-if %?SUBDIRS%
+ifdef SUBDIRS
RECURSIVE_TARGETS += cscopelist-recursive
cscopelist: cscopelist-recursive
-else !%?SUBDIRS%
+else
cscopelist: cscopelist-am
-endif !%?SUBDIRS%
+endif
cscopelist-am: $(am.tags.files)
list='$(am.tags.files)'; \
fi; \
done >> $(top_builddir)/cscope.files
-
-## ---------- ##
-## Cleaning. ##
-## ---------- ##
-
-am.clean.dist.f += TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-if %?TOPDIR_P%
-am.clean.dist.f += cscope.out cscope.in.out cscope.po.out cscope.files
-endif %?TOPDIR_P%
+endif # Dealing with tags.
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2010-2012 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# TAGS_DEPENDENCIES only make sense if other tag-worthy things (such as
-# sources) exist.
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AC_OUTPUT
-END
-
-cat >Makefile.am << 'END'
-TAGS_DEPENDENCIES = foo
-END
-
-$ACLOCAL
-AUTOMAKE_fails
-grep 'define.*TAGS_DEPENDENCIES.*without' stderr
-
-cat >>Makefile.am << 'END'
-bin_PROGRAMS = bar
-END
-
-AUTOMAKE_run
-grep 'define.*TAGS_DEPENDENCIES.*without' stderr && exit 1
-
-: