Update automake to version 1.10
[msysgit.git] / share / automake-1.10 / am / tags.am
blob80237df12b8a8eeeadfae7e801600b8ea7f558c7
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
3 ## Free Software Foundation, Inc.
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, USA.
20 ## ---- ##
21 ## ID.  ##
22 ## ---- ##
24 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
25 ## Make sure the list of sources is unique.
26         list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
27         unique=`for i in $$list; do \
28 ## Handle VPATH correctly.
29             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
30           done | \
31           $(AWK) '    { files[$$0] = 1; } \
32                END { for (i in files) print i; }'`; \
33         mkid -fID $$unique
36 ## ------ ##
37 ## TAGS.  ##
38 ## ------ ##
40 ETAGS = etags
41 .PHONY: tags
42 tags: TAGS
44 TAGS: %TAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \
45                 $(TAGS_FILES) $(LISP)
46         tags=; \
47         here=`pwd`; \
48 ## It is tempting to use if/endif here, but don't: the previous
49 ## backslash will cause bad results (automake doesn't `see' the `if').
50 ## Exuberant Ctags wants --etags-include,
51 ## GNU Etags             --include
52 ## Furthermore Exuberant Ctags 5.5.4 fails to create TAGS files
53 ## when no files are supplied, despite any --etags-include option.
54 ## A workaround is to pass `.' as a file.  This is what $empty_fix is for.
55 ?SUBDIRS?       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
56 ?SUBDIRS?         include_option=--etags-include; \
57 ?SUBDIRS?         empty_fix=.; \
58 ?SUBDIRS?       else \
59 ?SUBDIRS?         include_option=--include; \
60 ?SUBDIRS?         empty_fix=; \
61 ?SUBDIRS?       fi; \
62 ?SUBDIRS?       list='$(SUBDIRS)'; for subdir in $$list; do \
63 ## Do nothing if we're trying to look in `.'.
64 ?SUBDIRS?         if test "$$subdir" = .; then :; else \
65 ?SUBDIRS?           test ! -f $$subdir/TAGS || \
66 ## Note that the = is mandatory for --etags-include.
67 ?SUBDIRS?             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
68 ?SUBDIRS?         fi; \
69 ?SUBDIRS?       done; \
70 ## Make sure the list of sources is unique.
71         list='$(SOURCES) $(HEADERS) %CONFIG% $(LISP) $(TAGS_FILES)'; \
72         unique=`for i in $$list; do \
73 ## Handle VPATH correctly.
74             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
75           done | \
76           $(AWK) '    { files[$$0] = 1; } \
77                END { for (i in files) print i; }'`; \
78 ## Make sure we have something to run etags on.
79         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
80           test -n "$$unique" || unique=$$empty_fix; \
81           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
82             $$tags $$unique; \
83         fi
86 ## ------------- ##
87 ## vi-style tags ##
88 ## ------------- ##
90 CTAGS = ctags
91 .PHONY: CTAGS ctags
92 ctags: CTAGS
94 ## We have a dummy name here because `tags' has already been in use
95 ## for a long time to mean Emacs-style tags.  Oops.  This means the
96 ## dependencies here are useless.
97 CTAGS: %CTAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \
98                 $(TAGS_FILES) $(LISP)
99         tags=; \
100         here=`pwd`; \
101 ## Make sure the list of sources is unique.
102         list='$(SOURCES) $(HEADERS) %CONFIG% $(LISP) $(TAGS_FILES)'; \
103         unique=`for i in $$list; do \
104 ## Handle VPATH correctly.
105             if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
106           done | \
107           $(AWK) '    { files[$$0] = 1; } \
108                END { for (i in files) print i; }'`; \
109 ## Make sure we have something to run ctags on.
110         test -z "$(CTAGS_ARGS)$$tags$$unique" \
111           || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
112              $$tags $$unique
115 ## --------------- ##
116 ## `Global' tags.  ##
117 ## --------------- ##
119 .PHONY: GTAGS
120 GTAGS:
121         here=`$(am__cd) $(top_builddir) && pwd` \
122           && cd $(top_srcdir) \
123           && gtags -i $(GTAGS_ARGS) $$here
126 ## ---------- ##
127 ## Cleaning.  ##
128 ## ---------- ##
130 .PHONY distclean-am: distclean-tags
132 distclean-tags:
133         -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags