]>
Commit | Line | Data |
---|---|---|
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. | |
22 | TAGS: | |
23 | ||
24 | ifdef subdir | |
25 | .. := ../ | |
26 | endif | |
27 | ||
28 | include $(..)Makeconfig | |
29 | ||
30 | ifndef tags_sources | |
31 | ifeq ($(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 | 36 | tags_sources = $(all-headers) $(all-sources) $(all-dist) |
28f540f4 | 37 | else # Not ctype. |
e607b492 | 38 | tags_sources = $(all-sources) $(all-headers) $(all-dist) |
28f540f4 RM |
39 | endif # ctype |
40 | endif # No tags_sources | |
41 | ||
42 | sysdep-dirs := $(addprefix $(sysdep_dir)/,$(sysdirs)) | |
43 | ||
44 | ifndef sysdep_dirs | |
45 | # Find all sysdep directories. | |
8e3cc80f RM |
46 | sysdep_dirs := $(shell find $(..)sysdeps -type d \ |
47 | ! -name RCS ! -name CVS -print) | |
28f540f4 RM |
48 | endif |
49 | ||
50 | # Find all sysdep dirs there are, but putting the ones | |
51 | # we are configured to use first and preserving their order. | |
19c3f208 RM |
52 | all-dirs := $(subdir-dirs) \ |
53 | $(objdir) \ | |
28f540f4 RM |
54 | $(sysdep-dirs) \ |
55 | $(source_dirs) \ | |
56 | $(filter-out $(sysdep-dirs),$(sysdep_dirs)) | |
57 | ||
58 | # Find all the subdirs there are, but putting the ones | |
59 | # we are configured to use first and preserving their order. | |
60 | ifndef subdir | |
61 | subdirs := $(subdirs) \ | |
62 | $(filter-out $(subdirs),\ | |
63 | $(shell sed -e 's/\#.*$$//' \ | |
64 | $(wildcard $(addsuffix /Subdirs,\ | |
65 | $(all-dirs)))\ | |
66 | /dev/null)) | |
67 | all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\ | |
68 | $(addprefix $(Dist:%/Dist=%)/,\ | |
69 | $(filter %.c %.h %.S %.s,\ | |
70 | $(shell cat $(Dist))))) | |
71 | tags_sources = $(all-sources) $(all-headers) $(all-dist) | |
e607b492 RM |
72 | else |
73 | all-dist = $(distribute) | |
28f540f4 RM |
74 | endif |
75 | ||
8e3cc80f RM |
76 | sources += $(filter %.c %.s %.S,$(all-dist)) |
77 | headers += $(filter %.h,$(all-dist)) | |
78 | all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist)) | |
79 | ||
28f540f4 RM |
80 | # All different versions of $(sources), preserving the configured sysdep |
81 | # directory order. | |
19c3f208 RM |
82 | all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) \ |
83 | $(sources:.c=.s))) \ | |
84 | $(foreach dir,$(all-dirs),\ | |
85 | $(wildcard \ | |
86 | $(addprefix $(dir)/,\ | |
87 | $(sort $(sources) $(sources:.c=.S) \ | |
88 | $(sources:.c=.s))))) | |
89 | ||
90 | all-headers = $(wildcard $(headers)) \ | |
91 | $(foreach dir,$(all-dirs),\ | |
92 | $(wildcard $(addprefix $(dir)/,$(headers)))) | |
28f540f4 RM |
93 | |
94 | tags_sources := $(strip $(tags_sources)) | |
95 | ||
96 | TAGS: $(tags_sources) | |
97 | ifdef subdir | |
98 | ifdef tags_sources | |
99 | $(ETAGS) -o $@ $^ | |
100 | else | |
101 | # No sources. Create a dummy file. | |
102 | touch $@ | |
103 | endif # tags_sources | |
104 | else # parent | |
105 | TAGS: subdir_TAGS | |
106 | # Note that this uses the -i switch, and thus requires v19 etags. | |
107 | $(ETAGS) -o $@ \ | |
108 | $(subdirs:%=-i %/TAGS) \ | |
109 | $(filter-out subdir_TAGS,$^) | |
110 | ||
111 | .PHONY: subdir_TAGS $(subdirs:%=%/TAGS) | |
112 | subdir_TAGS: $(subdirs:%=%/TAGS) | |
113 | $(subdirs:%=%/TAGS): | |
114 | $(MAKE) -C $(@D) no_deps=t $(@F) | |
115 | ||
116 | endif # subdir |