]> sourceware.org Git - glibc.git/blame - MakeTAGS
Sun Jan 28 17:25:38 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / MakeTAGS
CommitLineData
28f540f4
RM
1# Make the TAGS files.
2
e607b492 3# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
28f540f4
RM
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.
e607b492 36tags_sources = $(all-headers) $(all-sources) $(all-dist)
28f540f4 37else # Not ctype.
e607b492 38tags_sources = $(all-sources) $(all-headers) $(all-dist)
28f540f4
RM
39endif # ctype
40endif # No tags_sources
41
42sysdep-dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
43
44ifndef sysdep_dirs
45# Find all sysdep directories.
8e3cc80f
RM
46sysdep_dirs := $(shell find $(..)sysdeps -type d \
47 ! -name RCS ! -name CVS -print)
28f540f4
RM
48endif
49
50# Find all sysdep dirs there are, but putting the ones
51# we are configured to use first and preserving their order.
52all-dirs := $(objdir) \
53 $(sysdep-dirs) \
54 $(source_dirs) \
55 $(filter-out $(sysdep-dirs),$(sysdep_dirs))
56
8e3cc80f
RM
57vpath %.h $(all-dirs)
58vpath %.c $(all-dirs)
59vpath %.S $(all-dirs)
60vpath %.s $(all-dirs)
61
28f540f4
RM
62# Find all the subdirs there are, but putting the ones
63# we are configured to use first and preserving their order.
64ifndef subdir
65subdirs := $(subdirs) \
66 $(filter-out $(subdirs),\
67 $(shell sed -e 's/\#.*$$//' \
68 $(wildcard $(addsuffix /Subdirs,\
69 $(all-dirs)))\
70 /dev/null))
71all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\
72 $(addprefix $(Dist:%/Dist=%)/,\
73 $(filter %.c %.h %.S %.s,\
74 $(shell cat $(Dist)))))
75tags_sources = $(all-sources) $(all-headers) $(all-dist)
e607b492
RM
76else
77all-dist = $(distribute)
28f540f4
RM
78endif
79
8e3cc80f
RM
80sources += $(filter %.c %.s %.S,$(all-dist))
81headers += $(filter %.h,$(all-dist))
82all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist))
83
28f540f4
RM
84# All different versions of $(sources), preserving the configured sysdep
85# directory order.
b8aec9fa 86all-sources = $(shell find . $(all-dirs) -maxdepth 1 \( -name fnord \
8e3cc80f
RM
87 $(foreach file,$(sort $(sources) $(sources:.c=.S) \
88 $(sources:.c=.s)),\
89 -o -name $(file)) \
90 \) -print)
91
b8aec9fa 92all-headers = $(shell find . $(all-dirs) -maxdepth 1 \( -name fnord \
8e3cc80f
RM
93 $(foreach file,$(headers),-o -name $(file)) \
94 \) -print)
28f540f4
RM
95
96tags_sources := $(strip $(tags_sources))
97
98TAGS: $(tags_sources)
99ifdef subdir
100ifdef tags_sources
101 $(ETAGS) -o $@ $^
102else
103# No sources. Create a dummy file.
104 touch $@
105endif # tags_sources
106else # parent
107TAGS: subdir_TAGS
108# Note that this uses the -i switch, and thus requires v19 etags.
109 $(ETAGS) -o $@ \
110 $(subdirs:%=-i %/TAGS) \
111 $(filter-out subdir_TAGS,$^)
112
113.PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
114subdir_TAGS: $(subdirs:%=%/TAGS)
115$(subdirs:%=%/TAGS):
116 $(MAKE) -C $(@D) no_deps=t $(@F)
117
118endif # subdir
This page took 0.047015 seconds and 5 git commands to generate.