]> sourceware.org Git - glibc.git/blame - MakeTAGS
initial import
[glibc.git] / MakeTAGS
CommitLineData
28f540f4
RM
1# Make the TAGS files.
2
3# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
4# This file is part of the GNU C Library.
5
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Library General Public License
8# as published by the Free Software Foundation; either version 2 of
9# the License, or (at your option) any later version.
10
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Library General Public License for more details.
15
16# You should have received a copy of the GNU Library General Public
17# License along with the GNU C Library; see the file COPYING.LIB. If
18# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19# Cambridge, MA 02139, USA.
20
21# Make this the default goal.
22TAGS:
23
24ifdef subdir
25.. := ../
26endif
27
28include $(..)Makeconfig
29
30ifndef tags_sources
31ifeq ($(subdir),ctype)
32# In most cases, we want the C source files to come before
33# the header files so tags for optimizing #define's in the
34# headers won't be put in the tags files, but for ctype,
35# the functions are just backup for the #define's in the header.
36tags_sources = $(all-headers) $(all-sources)
37else # Not ctype.
38tags_sources = $(all-sources) $(all-headers)
39endif # ctype
40endif # No tags_sources
41
42sysdep-dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
43
44ifndef sysdep_dirs
45# Find all sysdep directories.
46sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name RCS -print)
47endif
48
49# Find all sysdep dirs there are, but putting the ones
50# we are configured to use first and preserving their order.
51all-dirs := $(objdir) \
52 $(sysdep-dirs) \
53 $(source_dirs) \
54 $(filter-out $(sysdep-dirs),$(sysdep_dirs))
55
56# Find all the subdirs there are, but putting the ones
57# we are configured to use first and preserving their order.
58ifndef subdir
59subdirs := $(subdirs) \
60 $(filter-out $(subdirs),\
61 $(shell sed -e 's/\#.*$$//' \
62 $(wildcard $(addsuffix /Subdirs,\
63 $(all-dirs)))\
64 /dev/null))
65all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\
66 $(addprefix $(Dist:%/Dist=%)/,\
67 $(filter %.c %.h %.S %.s,\
68 $(shell cat $(Dist)))))
69tags_sources = $(all-sources) $(all-headers) $(all-dist)
70endif
71
72# All different versions of $(sources), preserving the configured sysdep
73# directory order.
74all-sources = $(wildcard $(foreach file,$(sources),\
75 $(file) \
76 $(foreach dir,$(all-dirs),\
77 $(dir)/$(file) \
78 $(dir)/$(file:.c=.S) \
79 $(dir)/$(file:.c=.s))))
80
81all-headers = $(wildcard $(foreach file,$(headers),\
82 $(file) \
83 $(foreach dir,$(all-dirs),$(dir)/$(file))))
84
85tags_sources := $(strip $(tags_sources))
86
87TAGS: $(tags_sources)
88ifdef subdir
89ifdef tags_sources
90 $(ETAGS) -o $@ $^
91else
92# No sources. Create a dummy file.
93 touch $@
94endif # tags_sources
95else # parent
96TAGS: subdir_TAGS
97# Note that this uses the -i switch, and thus requires v19 etags.
98 $(ETAGS) -o $@ \
99 $(subdirs:%=-i %/TAGS) \
100 $(filter-out subdir_TAGS,$^)
101
102.PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
103subdir_TAGS: $(subdirs:%=%/TAGS)
104$(subdirs:%=%/TAGS):
105 $(MAKE) -C $(@D) no_deps=t $(@F)
106
107endif # subdir
This page took 0.0369 seconds and 5 git commands to generate.