2 # Copyright (C) 1992,1994,1995,1996,1998,2002 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
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.
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
13 # Lesser General Public License for more details.
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
20 # Make this the default goal.
27 include $(..)Makeconfig
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.
35 tags_sources = $(all-headers) $(all-sources) $(all-dist)
37 tags_sources = $(all-sources) $(all-headers) $(all-dist)
39 endif # No tags_sources
41 sysdep-dirs := $(full_config_sysdirs)
44 # Find all sysdep directories.
45 sysdep_dirs := $(shell find $(..)sysdeps \
47 $(patsubst %,$(..)%/sysdeps,$(add-ons))) \
48 -type d ! -name RCS ! -name CVS \
52 # Find all sysdep dirs there are, but putting the ones
53 # we are configured to use first and preserving their order.
54 all-dirs := $(subdir-dirs) \
58 $(filter-out $(sysdep-dirs),$(sysdep_dirs))
60 # Find all the subdirs there are, but putting the ones
61 # we are configured to use first and preserving their order.
63 subdirs := $(subdirs) \
64 $(filter-out $(subdirs),\
66 $(shell sed -e 's/\#.*$$//' \
67 $(wildcard $(addsuffix /Subdirs,\
70 all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\
71 $(addprefix $(Dist:%/Dist=%)/,\
72 $(filter %.c %.h %.S %.s,\
73 $(shell cat $(Dist)))))
74 tags_sources = $(all-sources) $(all-headers) $(all-dist)
76 all-dist = $(distribute)
79 # sources and headers must be simply expanded variables
80 sources := $(sources) $(filter %.c %.s %.S,$(all-dist))
81 headers := $(headers) $(filter %.h,$(all-dist))
82 all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist))
84 sources += $(foreach lib,$(extra-libs),$($(lib)-routines:=.c))
86 # All different versions of $(sources), preserving the configured sysdep
88 # Files that are found in the current directory cannot occur in
89 # sysdep directories, so don't bother searching them.
90 sysdep-sources := $(filter-out $(wildcard $(sources)), $(sources))
91 all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) $(sources:.c=.s) \
92 $(others:=.c) $(tests:=.c) $(xtests:=.c) \
94 $(foreach dir,$(all-dirs),\
97 $(sort $(sysdep-sources) \
98 $(sysdep-sources:.c=.S) \
99 $(sysdep-sources:.c=.s)))))
101 sysdep-headers := $(filter-out $(wildcard $(headers)), $(headers))
102 all-headers = $(wildcard $(headers)) \
103 $(foreach dir,$(all-dirs),\
104 $(wildcard $(addprefix $(dir)/,$(sysdep-headers))))
106 tags_sources := $(strip $(tags_sources))
108 TAGS: $(tags_sources)
113 # No sources. Create a dummy file.
118 # Note that this uses the -i switch, and thus requires v19 etags.
120 $(subdirs:%=-i %/TAGS) \
121 $(filter-out subdir_TAGS,$^)
123 .PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
124 subdir_TAGS: $(subdirs:%=%/TAGS)
126 $(MAKE) -C $(@D) no_deps=t $(@F)
144 $(XGETTEXT) --keyword=_ --keyword=N_ --add-comments=TRANS --sort-by-file \
145 --omit-header -n -d - $(XGETTEXTFLAGS-$(@F)) > $@.new $^
149 text-srcs := $(filter %.c %.h %.cc %.C,$(tags_sources))
150 $P/$(domain).pot: $(text-srcs)
157 all-pot = $P/libc-top.pot $P/subdirs.pot
160 # Collect all the subdir messages, massaging the file names in comments
161 # to include the subdir name.
162 $P/subdirs.pot: $(subdirs:%=$P/%.pot)
164 (for d in $(subdirs); \
165 do sed "/^#:/s% % $$d/%g" $P/$$d.pot; done) > $@.new
168 # Combine all the messages into the final sorted template translation file.
169 # The following code requires GNU date.
170 $P/libc.pot: $(all-pot)
172 set `date -R`; disp="$$6"; \
173 sed -e 's/VERSION/$(version)/' \
174 -e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \
175 po/header.pot > $@.new
176 $(XGETTEXT) -d - --omit-header -n $^ >> $@.new
178 ifeq ($(with-cvs),yes)
179 test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@
182 $(subdirs:%=$P/%.pot): $P/%.pot: FORCE
183 $(MAKE) -C $* no_deps=t ../$@