]>
Commit | Line | Data |
---|---|---|
28f540f4 | 1 | # Make the TAGS files. |
567fb074 | 2 | # Copyright (C) 1992,1994,1995,1996,1998,2002 Free Software Foundation, Inc. |
28f540f4 RM |
3 | # This file is part of the GNU C Library. |
4 | ||
5 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | # modify it under the terms of the GNU Lesser General Public |
7 | # License as published by the Free Software Foundation; either | |
8 | # version 2.1 of the License, or (at your option) any later version. | |
28f540f4 RM |
9 | |
10 | # The GNU C Library 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 GNU | |
41bdb6e2 | 13 | # Lesser General Public License for more details. |
28f540f4 | 14 | |
41bdb6e2 AJ |
15 | # You should have received a copy of the GNU Lesser General Public |
16 | # License along with the GNU C Library; if not, write to the Free | |
17 | # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | # 02111-1307 USA. | |
28f540f4 RM |
19 | |
20 | # Make this the default goal. | |
21 | TAGS: | |
22 | ||
23 | ifdef subdir | |
24 | .. := ../ | |
25 | endif | |
26 | ||
27 | include $(..)Makeconfig | |
28 | ||
29 | ifndef tags_sources | |
30 | ifeq ($(subdir),ctype) | |
31 | # In most cases, we want the C source files to come before | |
32 | # the header files so tags for optimizing #define's in the | |
33 | # headers won't be put in the tags files, but for ctype, | |
34 | # the functions are just backup for the #define's in the header. | |
e607b492 | 35 | tags_sources = $(all-headers) $(all-sources) $(all-dist) |
28f540f4 | 36 | else # Not ctype. |
e607b492 | 37 | tags_sources = $(all-sources) $(all-headers) $(all-dist) |
28f540f4 RM |
38 | endif # ctype |
39 | endif # No tags_sources | |
40 | ||
0a55a284 | 41 | sysdep-dirs := $(full_config_sysdirs) |
28f540f4 RM |
42 | |
43 | ifndef sysdep_dirs | |
44 | # Find all sysdep directories. | |
47707456 UD |
45 | sysdep_dirs := $(shell find $(..)sysdeps \ |
46 | $(wildcard \ | |
47 | $(patsubst %,$(..)%/sysdeps,$(add-ons))) \ | |
abe71ca6 UD |
48 | -type d ! -name RCS ! -name CVS \ |
49 | ! -name SCCS -print) | |
28f540f4 RM |
50 | endif |
51 | ||
52 | # Find all sysdep dirs there are, but putting the ones | |
53 | # we are configured to use first and preserving their order. | |
19c3f208 RM |
54 | all-dirs := $(subdir-dirs) \ |
55 | $(objdir) \ | |
28f540f4 RM |
56 | $(sysdep-dirs) \ |
57 | $(source_dirs) \ | |
58 | $(filter-out $(sysdep-dirs),$(sysdep_dirs)) | |
59 | ||
60 | # Find all the subdirs there are, but putting the ones | |
61 | # we are configured to use first and preserving their order. | |
62 | ifndef subdir | |
63 | subdirs := $(subdirs) \ | |
64 | $(filter-out $(subdirs),\ | |
65 | $(shell sed -e 's/\#.*$$//' \ | |
66 | $(wildcard $(addsuffix /Subdirs,\ | |
67 | $(all-dirs)))\ | |
68 | /dev/null)) | |
69 | all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\ | |
70 | $(addprefix $(Dist:%/Dist=%)/,\ | |
71 | $(filter %.c %.h %.S %.s,\ | |
72 | $(shell cat $(Dist))))) | |
73 | tags_sources = $(all-sources) $(all-headers) $(all-dist) | |
e607b492 RM |
74 | else |
75 | all-dist = $(distribute) | |
28f540f4 RM |
76 | endif |
77 | ||
a4242e25 RM |
78 | # sources and headers must be simply expanded variables |
79 | sources := $(sources) $(filter %.c %.s %.S,$(all-dist)) | |
80 | headers := $(headers) $(filter %.h,$(all-dist)) | |
8e3cc80f RM |
81 | all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist)) |
82 | ||
c3352e62 RM |
83 | sources += $(foreach lib,$(extra-libs),$($(lib)-routines:=.c)) |
84 | ||
28f540f4 RM |
85 | # All different versions of $(sources), preserving the configured sysdep |
86 | # directory order. | |
6952e59e UD |
87 | # Files that are found in the current directory cannot occur in |
88 | # sysdep directories, so don't bother searching them. | |
89 | sysdep-sources := $(filter-out $(wildcard $(sources)), $(sources)) | |
e61abf83 | 90 | all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) $(sources:.c=.s) \ |
c238ecf7 UD |
91 | $(others:=.c) $(tests:=.c) $(xtests:=.c) \ |
92 | $(test-srcs:=.c))) \ | |
19c3f208 RM |
93 | $(foreach dir,$(all-dirs),\ |
94 | $(wildcard \ | |
95 | $(addprefix $(dir)/,\ | |
6952e59e UD |
96 | $(sort $(sysdep-sources) \ |
97 | $(sysdep-sources:.c=.S) \ | |
98 | $(sysdep-sources:.c=.s))))) | |
19c3f208 | 99 | |
6952e59e | 100 | sysdep-headers := $(filter-out $(wildcard $(headers)), $(headers)) |
19c3f208 RM |
101 | all-headers = $(wildcard $(headers)) \ |
102 | $(foreach dir,$(all-dirs),\ | |
6952e59e | 103 | $(wildcard $(addprefix $(dir)/,$(sysdep-headers)))) |
28f540f4 RM |
104 | |
105 | tags_sources := $(strip $(tags_sources)) | |
106 | ||
107 | TAGS: $(tags_sources) | |
108 | ifdef subdir | |
109 | ifdef tags_sources | |
110 | $(ETAGS) -o $@ $^ | |
111 | else | |
a182affd | 112 | # No sources. Create a dummy file. |
28f540f4 RM |
113 | touch $@ |
114 | endif # tags_sources | |
115 | else # parent | |
116 | TAGS: subdir_TAGS | |
117 | # Note that this uses the -i switch, and thus requires v19 etags. | |
118 | $(ETAGS) -o $@ \ | |
119 | $(subdirs:%=-i %/TAGS) \ | |
120 | $(filter-out subdir_TAGS,$^) | |
121 | ||
122 | .PHONY: subdir_TAGS $(subdirs:%=%/TAGS) | |
123 | subdir_TAGS: $(subdirs:%=%/TAGS) | |
124 | $(subdirs:%=%/TAGS): | |
125 | $(MAKE) -C $(@D) no_deps=t $(@F) | |
126 | ||
127 | endif # subdir | |
a182affd RM |
128 | \f |
129 | ifndef XGETTEXT | |
130 | XGETTEXT = xgettext | |
131 | endif | |
a182affd RM |
132 | |
133 | P = $(..)po | |
134 | ||
135 | ifdef subdir | |
136 | domain = $(subdir) | |
137 | else | |
138 | domain = libc-top | |
139 | endif | |
140 | ||
141 | define extract | |
142 | @rm -f $@.new | |
567fb074 | 143 | $(XGETTEXT) --keyword=_ --keyword=N_ --add-comments=TRANS --sort-by-file \ |
706074a5 | 144 | --omit-header -n -d - $(XGETTEXTFLAGS-$(@F)) > $@.new $^ |
a182affd RM |
145 | mv -f $@.new $@ |
146 | endef | |
147 | ||
857fa1b8 RM |
148 | text-srcs := $(filter %.c %.h %.cc %.C,$(tags_sources)) |
149 | $P/$(domain).pot: $(text-srcs) | |
150 | ifeq (,$(text-srcs)) | |
151 | cp /dev/null $@ | |
152 | else | |
153 | $(extract) | |
154 | endif | |
a182affd | 155 | |
df4ef2ab | 156 | all-pot = $P/libc-top.pot $P/subdirs.pot |
a182affd RM |
157 | |
158 | ifndef subdir | |
7a1c652d RM |
159 | # Collect all the subdir messages, massaging the file names in comments |
160 | # to include the subdir name. | |
161 | $P/subdirs.pot: $(subdirs:%=$P/%.pot) | |
162 | @rm -f $@.new | |
163 | (for d in $(subdirs); \ | |
14bab8de | 164 | do sed "/^#:/s% % $$d/%g" $P/$$d.pot; done) > $@.new |
7a1c652d RM |
165 | mv -f $@.new $@ |
166 | ||
167 | # Combine all the messages into the final sorted template translation file. | |
ec4b0518 | 168 | # The following code requires GNU date. |
8ca5c11b | 169 | $P/libc.pot: $(all-pot) |
a182affd | 170 | @rm -f $@.new |
0d204b0a | 171 | set `date -R`; disp="$$6"; \ |
ec4b0518 | 172 | sed -e 's/VERSION/$(version)/' \ |
0d204b0a | 173 | -e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \ |
299a95b9 | 174 | po/header.pot > $@.new |
706074a5 | 175 | $(XGETTEXT) -d - --omit-header -n -s $^ >> $@.new |
a182affd | 176 | mv -f $@.new $@ |
880f421f | 177 | ifeq ($(with-cvs),yes) |
379bb425 | 178 | test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@ |
880f421f | 179 | endif |
a182affd RM |
180 | |
181 | $(subdirs:%=$P/%.pot): $P/%.pot: FORCE | |
182 | $(MAKE) -C $* no_deps=t ../$@ | |
183 | FORCE: | |
184 | endif |