]> git.ipfire.org Git - thirdparty/glibc.git/blob - Makefile
Update.
[thirdparty/glibc.git] / Makefile
1 # Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
13
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18
19 #
20 # Master Makefile for the GNU C library
21 #
22 ifneq (,)
23 This makefile requires GNU Make.
24 endif
25
26 include Makeconfig
27
28
29 # This is the default target; it makes everything except the tests.
30 .PHONY: all
31 all: lib others
32 \f
33 ifeq ($(with-cvs),yes)
34 define autoconf-it
35 @-rm -f $@.new
36 autoconf $(ACFLAGS) $< > $@.new
37 chmod a-w,a+x $@.new
38 mv -f $@.new $@
39 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
40 endef
41 else
42 define autoconf-it
43 @-rm -f $@.new
44 autoconf $(ACFLAGS) $< > $@.new
45 chmod a-w,a+x $@.new
46 mv -f $@.new $@
47 endef
48 endif
49
50 configure: configure.in aclocal.m4; $(autoconf-it)
51 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
52
53 # These are the targets that are made by making them in each subdirectory.
54 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
55 subdir_clean subdir_distclean subdir_realclean \
56 tests subdir_lint.out \
57 subdir_distinfo \
58 subdir_echo-headers subdir_echo-distinfo \
59 subdir_install \
60 $(addprefix install-, no-libc.a bin lib data headers others)
61 \f
62 headers := errno.h sys/errno.h bits/errno.h limits.h values.h \
63 features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h \
64 gnu/libc-version.h
65
66 echo-headers: subdir_echo-headers
67
68 # The headers are in the include directory.
69 subdir-dirs = include
70 vpath %.h $(subdir-dirs)
71
72 # What to install.
73 install-others = $(inst_includedir)/gnu/stubs.h
74 install-bin = glibcbug
75
76 ifeq (yes,$(build-shared))
77 install-others += $(inst_includedir)/gnu/lib-names.h
78 endif
79
80 include Makerules
81
82 # Install from subdirectories too.
83 install: subdir_install
84
85 # Make sure that the dynamic linker is installed before libc.
86 $(inst_slibdir)/libc-$(version).so: elf/ldso_install
87
88 .PHONY: elf/ldso_install
89 elf/ldso_install:
90 $(MAKE) -C $(@D) $(@F)
91
92 # Create links for shared libraries using the `ldconfig' program is possible.
93 # Ignore the error if we cannot update /etc/ld.so.cache.
94 ifeq (no,$(cross-compiling))
95 ifeq (yes,$(build-shared))
96 install:
97 -test ! -x $(common-objpfx)elf/ldconfig || \
98 $(common-objpfx)elf/ldconfig -d $(inst_slibdir) $(inst_libdir)
99 ifneq (no,$(PERL))
100 ifeq (/usr,$(prefix))
101 ifeq (,$(install_root))
102 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
103 endif
104 endif
105 endif
106 endif
107 endif
108
109 # Build subdirectory lib objects.
110 lib-noranlib: subdir_lib
111
112 ifeq (yes,$(build-shared))
113 # Build the shared object from the PIC object library.
114 lib: $(common-objpfx)libc.so
115 endif
116 \f
117 # Makerules creates a file `stubs' in each subdirectory, which
118 # contains `#define __stub_FUNCTION' for each function defined in that
119 # directory which is a stub.
120 # Here we paste all of these together into <gnu/stubs.h>.
121
122 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
123
124 # Since stubs.h is never needed when building the library, we simplify the
125 # hairy installation process by producing it in place only as the last part
126 # of the top-level `make install'. It depends on subdir_install, which
127 # iterates over all the subdirs; subdir_install in each subdir depends on
128 # the subdir's stubs file. Having more direct dependencies would result in
129 # extra iterations over the list for subdirs and many recursive makes.
130 $(inst_includedir)/gnu/stubs.h: subdir_install
131 $(make-target-directory)
132 @rm -f $(objpfx)stubs.h
133 (echo '/* This file is automatically generated.';\
134 echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
135 echo ' in the C library which is a stub, meaning it will fail';\
136 echo ' every time called, usually setting errno to ENOSYS. */';\
137 sort $(subdir-stubs)) > $(objpfx)stubs.h
138 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
139 then echo 'stubs.h unchanged'; \
140 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
141 rm -f $(objpfx)stubs.h
142 \f
143 ifeq (yes,$(build-shared))
144
145 $(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h $(+force)
146 $(make-target-directory)
147 if test -r $@ && cmp -s $< $@; \
148 then echo 'gnu/lib-names.h unchanged'; \
149 else $(INSTALL_DATA) $< $@; fi
150 endif
151 \f
152 # The `glibcbug' script contains the version number and it shall be rebuild
153 # whenever this changes or the `glibcbug.in' file.
154 $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
155 cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
156 \f
157 # This makes the Info or DVI file of the documentation from the Texinfo source.
158 .PHONY: info dvi
159 info dvi:
160 $(MAKE) $(PARALLELMFLAGS) -C manual $@
161 \f
162 # This makes all the subdirectory targets.
163
164 # For each target, make it depend on DIR/target for each subdirectory DIR.
165 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
166
167 # Compute a list of all those targets.
168 all-subdirs-targets := $(foreach dir,$(subdirs),\
169 $(addprefix $(dir)/,$(+subdir_targets)))
170
171 # The action for each of those is to cd into the directory and make the
172 # target there.
173 $(all-subdirs-targets):
174 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
175
176 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
177 \f
178 # Targets to clean things up to various degrees.
179
180 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean
181
182 # Subroutines of all cleaning targets.
183 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
184 -rm -f $(foreach o,$(object-suffixes-for-libc),\
185 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
186 $(addprefix $(objpfx),$(install-lib))
187 parent-clean: parent-mostlyclean common-clean
188
189 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
190 $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules) \
191 $(objpfx)soversions.mk
192
193 clean: parent-clean
194 # This is done this way rather than having `subdir_clean' be a
195 # dependency of this target so that libc.a will be removed before the
196 # subdirectories are dealt with and so they won't try to remove object
197 # files from it when it's going to be removed anyway.
198 @$(MAKE) subdir_clean no_deps=t
199 mostlyclean: parent-mostlyclean
200 @$(MAKE) subdir_mostlyclean no_deps=t
201 -rm -f $(postclean)
202
203 # The realclean target is just like distclean for the parent, but we want
204 # the subdirs to know the difference in case they care.
205 realclean distclean: parent-clean
206 # This is done this way rather than having `subdir_distclean' be a
207 # dependency of this target so that libc.a will be removed before the
208 # subdirectories are dealt with and so they won't try to remove object
209 # files from it when it's going to be removed anyway.
210 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
211 sysdep-subdirs="$(sysdep-subdirs)"
212 -rm -f $(postclean)
213
214 # Subroutine of distclean and realclean.
215 distclean-1: subdir_$(distclean-1)
216 -rm -f $(config-generated)
217 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
218 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
219 -rm -f $(addprefix $(objpfx),glibcbug)
220 ifdef objdir
221 -rm -f $(objpfx)Makefile
222 endif
223 -rm -f $(sysdep-$(distclean-1))
224 \f
225 .PHONY: echo_subdirs
226 echo_subdirs:;@echo '$(subdirs)'
227
228 .PHONY: echo-distinfo parent_echo-distinfo
229 echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
230 parent_echo-distinfo:
231 @echo $(addprefix +header+,$(headers)) \
232 $(addprefix +nodist+,$(generated))
233
234 \f
235 # Make the distribution tarfile.
236
237 distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
238 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
239 Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
240 extra-lib.mk o-iterator.mk libc.map configure \
241 configure.in aclocal.m4 config.h.in config.make.in \
242 config-name.in Makefile.in sysdep.h set-hooks.h \
243 libc-symbols.h version.h shlib-versions rpm/Makefile \
244 rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
245 test-skeleton.c include/des.h \
246 $(addprefix scripts/, \
247 rellns-sh config.sub config.guess \
248 mkinstalldirs move-if-change install-sh \
249 test-installation.pl gen-FAQ.pl)
250
251 distribute := $(strip $(distribute))
252 generated := $(generated) stubs.h
253
254 README: README.template version.h ; # Make-dist should update README.
255
256 define format-me
257 @rm -f $@
258 makeinfo --no-validate --no-warn --no-headers $< -o $@
259 -chmod a-w $@
260 endef
261 INSTALL: manual/install.texi; $(format-me)
262 NOTES: manual/creature.texi; $(format-me)
263 manual/dir-add.texi manual/dir-add.info: FORCE
264 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
265 FAQ: scripts/gen-FAQ.pl FAQ.in
266 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
267 ifeq ($(with-cvs),yes)
268 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
269 endif
270 FORCE:
271
272 rpm/%: subdir_distinfo
273 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
274
275 iconvdata/%:
276 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
277
278 # This is a special goal for people making binary distributions. Normally
279 # everybody uses the DES based crypt library but for the distribution we
280 # need the only-MD5 based one as well.
281 md5-crypt/libmd5crypt:
282 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)