1## automake - create Makefile.in from Makefile.am
2## Copyright (C) 1994-2021 Free Software Foundation, Inc.
3
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2, or (at your option)
7## any later version.
8
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13
14## You should have received a copy of the GNU General Public License
15## along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17# Read a list of newline-separated strings from the standard input,
18# and print each of them once, without duplicates.  Input order is
19# *not* preserved.
20am__uniquify_input = $(AWK) '\
21  BEGIN { nonempty = 0; } \
22  { items[$$0] = 1; nonempty = 1; } \
23  END { if (nonempty) { for (i in items) print i; }; } \
24'
25
26# Make sure the list of sources is unique.  This is necessary because,
27# e.g., the same source file might be shared among _SOURCES variables
28# for different programs/libraries.
29am__define_uniq_tagged_files = \
30  list='$(am__tagged_files)'; \
31  unique=`for i in $$list; do \
32## Handle VPATH correctly.
33    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
34  done | $(am__uniquify_input)`
35
36## ---- ##
37## ID.  ##
38## ---- ##
39
40ID: $(am__tagged_files)
41	$(am__define_uniq_tagged_files); mkid -fID $$unique
42
43
44## ------ ##
45## TAGS.  ##
46## ------ ##
47
48.PHONY: TAGS tags
49if %?SUBDIRS%
50AM_RECURSIVE_TARGETS += TAGS
51RECURSIVE_TARGETS += tags-recursive
52tags: tags-recursive
53else !%?SUBDIRS%
54tags: tags-am
55endif !%?SUBDIRS%
56TAGS: tags
57
58tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
59## We use the positional parameters to build the subdir list with
60## absolute names, without the need to worry about white space in `pwd`.
61	set x; \
62	here=`pwd`; \
63## Exuberant Ctags wants --etags-include,
64## GNU Etags             --include
65## Furthermore Exuberant Ctags 5.5.4 fails to create TAGS files
66## when no files are supplied, despite any --etags-include option.
67## A workaround is to pass '.' as a file.  This is what $empty_fix is for.
68?SUBDIRS?	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
69?SUBDIRS?	  include_option=--etags-include; \
70?SUBDIRS?	  empty_fix=.; \
71?SUBDIRS?	else \
72?SUBDIRS?	  include_option=--include; \
73?SUBDIRS?	  empty_fix=; \
74?SUBDIRS?	fi; \
75?SUBDIRS?	list='$(SUBDIRS)'; for subdir in $$list; do \
76## Do nothing if we're trying to look in '.'.
77?SUBDIRS?	  if test "$$subdir" = .; then :; else \
78?SUBDIRS?	    test ! -f $$subdir/TAGS || \
79## Note that the = is mandatory for --etags-include.
80?SUBDIRS?	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
81?SUBDIRS?	  fi; \
82?SUBDIRS?	done; \
83	$(am__define_uniq_tagged_files); \
84## Remove the 'x' we added first:
85	shift; \
86## Make sure we have something to run etags on.
87	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
88	  test -n "$$unique" || unique=$$empty_fix; \
89	  if test $$# -gt 0; then \
90	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
91	      "$$@" $$unique; \
92	  else \
93	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
94	      $$unique; \
95	  fi; \
96	fi
97
98
99## --------------- ##
100## vi-style tags.  ##
101## --------------- ##
102
103.PHONY: CTAGS ctags
104if %?SUBDIRS%
105AM_RECURSIVE_TARGETS += CTAGS
106RECURSIVE_TARGETS += ctags-recursive
107ctags: ctags-recursive
108else !%?SUBDIRS%
109ctags: ctags-am
110endif !%?SUBDIRS%
111
112CTAGS: ctags
113ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
114	$(am__define_uniq_tagged_files); \
115## Make sure we have something to run ctags on.
116	test -z "$(CTAGS_ARGS)$$unique" \
117	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
118	     $$unique
119
120
121## --------------- ##
122## "Global tags".  ##
123## --------------- ##
124
125.PHONY: GTAGS
126GTAGS:
127	here=`$(am__cd) $(top_builddir) && pwd` \
128	  && $(am__cd) $(top_srcdir) \
129	  && gtags -i $(GTAGS_ARGS) "$$here"
130
131
132## ------- ##
133## cscope  ##
134## ------- ##
135
136if %?TOPDIR_P%
137.PHONY: cscope clean-cscope
138AM_RECURSIVE_TARGETS += cscope
139cscope: cscope.files
140	test ! -s cscope.files \
141	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
142clean-cscope:
143	-rm -f cscope.files
144cscope.files: clean-cscope cscopelist
145endif %?TOPDIR_P%
146
147if %?SUBDIRS%
148RECURSIVE_TARGETS += cscopelist-recursive
149cscopelist: cscopelist-recursive
150else !%?SUBDIRS%
151cscopelist: cscopelist-am
152endif !%?SUBDIRS%
153
154cscopelist-am: $(am__tagged_files)
155	list='$(am__tagged_files)'; \
156	case "$(srcdir)" in \
157	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
158	  *) sdir=$(subdir)/$(srcdir) ;; \
159	esac; \
160	for i in $$list; do \
161	  if test -f "$$i"; then \
162	    echo "$(subdir)/$$i"; \
163	  else \
164	    echo "$$sdir/$$i"; \
165	  fi; \
166	done >> $(top_builddir)/cscope.files
167
168
169## ---------- ##
170## Cleaning.  ##
171## ---------- ##
172
173.PHONY distclean-am: distclean-tags
174
175distclean-tags:
176	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
177if %?TOPDIR_P%
178	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
179endif %?TOPDIR_P%
180