]> sourceware.org Git - glibc.git/blame - MakeTAGS
Update.
[glibc.git] / MakeTAGS
CommitLineData
28f540f4
RM
1# Make the TAGS files.
2
379bb425 3# Copyright (C) 1992, 1994, 1995, 1996, 1998 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
47707456
UD
17# License along with the GNU C Library; see the file COPYING.LIB. If not,
18# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
28f540f4
RM
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
ba1ffaa1 42sysdep-dirs := $(full-config-sysdirs)
28f540f4
RM
43
44ifndef sysdep_dirs
45# Find all sysdep directories.
47707456
UD
46sysdep_dirs := $(shell find $(..)sysdeps \
47 $(wildcard \
48 $(patsubst %,$(..)%/sysdeps,$(add-ons))) \
49 -type d ! -name RCS ! -name CVS -print)
28f540f4
RM
50endif
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
54all-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.
62ifndef subdir
63subdirs := $(subdirs) \
64 $(filter-out $(subdirs),\
65 $(shell sed -e 's/\#.*$$//' \
66 $(wildcard $(addsuffix /Subdirs,\
67 $(all-dirs)))\
68 /dev/null))
69all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\
70 $(addprefix $(Dist:%/Dist=%)/,\
71 $(filter %.c %.h %.S %.s,\
72 $(shell cat $(Dist)))))
73tags_sources = $(all-sources) $(all-headers) $(all-dist)
e607b492
RM
74else
75all-dist = $(distribute)
28f540f4
RM
76endif
77
a4242e25
RM
78# sources and headers must be simply expanded variables
79sources := $(sources) $(filter %.c %.s %.S,$(all-dist))
80headers := $(headers) $(filter %.h,$(all-dist))
8e3cc80f
RM
81all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist))
82
c3352e62
RM
83sources += $(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.
89sysdep-sources := $(filter-out $(wildcard $(sources)), $(sources))
e61abf83
UD
90all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) $(sources:.c=.s) \
91 $(others:=.c) $(tests:=.c) $(test-srcs:=.c))) \
19c3f208
RM
92 $(foreach dir,$(all-dirs),\
93 $(wildcard \
94 $(addprefix $(dir)/,\
6952e59e
UD
95 $(sort $(sysdep-sources) \
96 $(sysdep-sources:.c=.S) \
97 $(sysdep-sources:.c=.s)))))
19c3f208 98
6952e59e 99sysdep-headers := $(filter-out $(wildcard $(headers)), $(headers))
19c3f208
RM
100all-headers = $(wildcard $(headers)) \
101 $(foreach dir,$(all-dirs),\
6952e59e 102 $(wildcard $(addprefix $(dir)/,$(sysdep-headers))))
28f540f4
RM
103
104tags_sources := $(strip $(tags_sources))
105
106TAGS: $(tags_sources)
107ifdef subdir
108ifdef tags_sources
109 $(ETAGS) -o $@ $^
110else
a182affd 111# No sources. Create a dummy file.
28f540f4
RM
112 touch $@
113endif # tags_sources
114else # parent
115TAGS: subdir_TAGS
116# Note that this uses the -i switch, and thus requires v19 etags.
117 $(ETAGS) -o $@ \
118 $(subdirs:%=-i %/TAGS) \
119 $(filter-out subdir_TAGS,$^)
120
121.PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
122subdir_TAGS: $(subdirs:%=%/TAGS)
123$(subdirs:%=%/TAGS):
124 $(MAKE) -C $(@D) no_deps=t $(@F)
125
126endif # subdir
a182affd
RM
127\f
128ifndef XGETTEXT
129XGETTEXT = xgettext
130endif
a182affd
RM
131
132P = $(..)po
133
134ifdef subdir
135domain = $(subdir)
136else
137domain = libc-top
138endif
139
140define extract
141@rm -f $@.new
706074a5
UD
142$(XGETTEXT) --keyword=_ --keyword=N_ --add-comments=TRANS --sort-output \
143 --omit-header -n -d - $(XGETTEXTFLAGS-$(@F)) > $@.new $^
a182affd
RM
144mv -f $@.new $@
145endef
146
857fa1b8
RM
147text-srcs := $(filter %.c %.h %.cc %.C,$(tags_sources))
148$P/$(domain).pot: $(text-srcs)
149ifeq (,$(text-srcs))
150 cp /dev/null $@
151else
152 $(extract)
153endif
a182affd 154
df4ef2ab 155all-pot = $P/libc-top.pot $P/subdirs.pot
a182affd
RM
156
157ifndef subdir
7a1c652d
RM
158# Collect all the subdir messages, massaging the file names in comments
159# to include the subdir name.
160$P/subdirs.pot: $(subdirs:%=$P/%.pot)
161 @rm -f $@.new
162 (for d in $(subdirs); \
14bab8de 163 do sed "/^#:/s% % $$d/%g" $P/$$d.pot; done) > $@.new
7a1c652d
RM
164 mv -f $@.new $@
165
166# Combine all the messages into the final sorted template translation file.
ec4b0518 167# The following code requires GNU date.
8ca5c11b 168$P/libc.pot: $(all-pot)
a182affd 169 @rm -f $@.new
0d204b0a 170 set `date -R`; disp="$$6"; \
ec4b0518 171 sed -e 's/VERSION/$(version)/' \
0d204b0a 172 -e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \
299a95b9 173 po/header.pot > $@.new
706074a5 174 $(XGETTEXT) -d - --omit-header -n -s $^ >> $@.new
a182affd 175 mv -f $@.new $@
880f421f 176ifeq ($(with-cvs),yes)
379bb425 177 test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@
880f421f 178endif
a182affd
RM
179
180$(subdirs:%=$P/%.pot): $P/%.pot: FORCE
181 $(MAKE) -C $* no_deps=t ../$@
182FORCE:
183endif
This page took 0.072861 seconds and 5 git commands to generate.