2 # Copyright (C) 1992,1994,1995,1996,1998,2002,2003
3 # Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
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 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, write to the Free
18 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # Make this the default goal.
28 include $(..)Makeconfig
30 # Pass these to $(MAKE) calls to avoid source generation and such.
31 sub-make-vars = generating=t no_deps=t
34 ifeq ($(subdir),ctype)
35 # In most cases, we want the C source files to come before
36 # the header files so tags for optimizing #define's in the
37 # headers won't be put in the tags files, but for ctype,
38 # the functions are just backup for the #define's in the header.
39 tags_sources = $(all-headers) $(all-sources) $(all-dist)
41 tags_sources = $(all-sources) $(all-headers) $(all-dist)
43 endif # No tags_sources
45 sysdep-dirs := $(full_config_sysdirs)
48 # Find all sysdep directories.
49 sysdep_dirs := $(shell find $(..)sysdeps \
51 $(patsubst %,$(..)%/sysdeps,$(add-ons))) \
52 -type d ! -name RCS ! -name CVS \
56 # Find all sysdep dirs there are, but putting the ones
57 # we are configured to use first and preserving their order.
58 all-dirs := $(subdir-dirs) \
62 $(filter-out $(sysdep-dirs),$(sysdep_dirs))
64 # Find all the subdirs there are, but putting the ones
65 # we are configured to use first and preserving their order.
67 subdirs := $(subdirs) \
68 $(filter-out $(subdirs),\
70 $(shell sed -e 's/\#.*$$//' \
71 $(wildcard $(addsuffix /Subdirs,\
74 all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\
75 $(addprefix $(Dist:%/Dist=%)/,\
76 $(filter %.c %.h %.S %.s,\
77 $(shell cat $(Dist)))))
78 tags_sources = $(all-sources) $(all-headers) $(all-dist)
80 all-dist = $(distribute)
83 # sources and headers must be simply expanded variables
84 sources := $(sources) $(filter %.c %.s %.S,$(all-dist))
85 headers := $(headers) $(filter %.h,$(all-dist))
86 all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist))
88 sources += $(foreach lib,$(extra-libs),$($(lib)-routines:=.c))
90 # All different versions of $(sources), preserving the configured sysdep
92 # Files that are found in the current directory cannot occur in
93 # sysdep directories, so don't bother searching them.
94 sysdep-sources := $(filter-out $(wildcard $(sources)), $(sources))
95 all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) $(sources:.c=.s) \
96 $(others:=.c) $(tests:=.c) $(xtests:=.c) \
98 $(foreach dir,$(all-dirs),\
100 $(addprefix $(dir)/,\
101 $(sort $(sysdep-sources) \
102 $(sysdep-sources:.c=.S) \
103 $(sysdep-sources:.c=.s)))))
105 sysdep-headers := $(filter-out $(wildcard $(headers)), $(headers))
106 all-headers = $(wildcard $(headers)) \
107 $(foreach dir,$(all-dirs),\
108 $(wildcard $(addprefix $(dir)/,$(sysdep-headers))))
110 tags_sources := $(strip $(tags_sources))
112 TAGS: $(tags_sources)
117 # No sources. Create a dummy file.
122 # Note that this uses the -i switch, and thus requires v19 etags.
124 $(subdirs:%=-i %/TAGS) \
125 $(filter-out subdir_TAGS,$^)
127 .PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
128 subdir_TAGS: $(subdirs:%=%/TAGS)
130 $(MAKE) -C $(@D) $(sub-make-vars) $(@F)
148 $(XGETTEXT) --keyword=_ --keyword=N_ --add-comments=TRANS --sort-by-file \
149 --omit-header -E -n -d - $(XGETTEXTFLAGS-$(@F)) > $@.new $^
153 text-srcs := $(filter %.c %.h %.cc %.C,$(tags_sources))
154 $P/$(domain).pot: $(text-srcs)
161 all-pot = $P/libc-top.pot $P/subdirs.pot
164 # Collect all the subdir messages, massaging the file names in comments
165 # to include the subdir name.
166 $P/subdirs.pot: $(subdirs:%=$P/%.pot)
168 (for d in $(subdirs); \
169 do sed "/^#:/s% % $$d/%g" $P/$$d.pot; done) > $@.new
172 # Combine all the messages into the final sorted template translation file.
173 # The following code requires GNU date.
174 $P/libc.pot: $(all-pot)
176 set `date -R`; disp="$$6"; \
177 sed -e 's/VERSION/$(version)/' \
178 -e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \
179 po/header.pot > $@.new
180 $(XGETTEXT) -d - --omit-header -E -n $^ >> $@.new
182 ifeq ($(with-cvs),yes)
183 test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@
186 $(subdirs:%=$P/%.pot): $P/%.pot: FORCE
187 $(MAKE) -C $* $(sub-make-vars) ../$@