]>
Commit | Line | Data |
---|---|---|
379bb425 | 1 | # Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. |
28f540f4 RM |
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 | |
2c6fe0bd UD |
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. | |
28f540f4 RM |
18 | |
19 | # | |
20 | # Master Makefile for the GNU C library | |
21 | # | |
22 | ifneq (,) | |
23 | This makefile requires GNU Make. | |
24 | endif | |
25 | ||
aa802e96 UD |
26 | include Makeconfig |
27 | ||
28f540f4 RM |
28 | |
29 | # This is the default target; it makes everything except the tests. | |
30 | .PHONY: all | |
edf5b2d7 | 31 | all: lib others |
28f540f4 | 32 | \f |
4d06461a | 33 | ifeq ($(with-cvs),yes) |
28f540f4 | 34 | define autoconf-it |
587dbc6f | 35 | @-rm -f $@.new |
28f540f4 | 36 | autoconf $(ACFLAGS) $< > $@.new |
587dbc6f | 37 | chmod a-w,a+x $@.new |
28f540f4 | 38 | mv -f $@.new $@ |
379bb425 | 39 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@ |
28f540f4 | 40 | endef |
4d06461a UD |
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 | |
28f540f4 | 49 | |
dbdb6189 RM |
50 | configure: configure.in aclocal.m4; $(autoconf-it) |
51 | %/configure: %/configure.in aclocal.m4; $(autoconf-it) | |
28f540f4 | 52 | |
28f540f4 | 53 | # These are the targets that are made by making them in each subdirectory. |
edf5b2d7 UD |
54 | +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \ |
55 | subdir_clean subdir_distclean subdir_realclean \ | |
56 | tests subdir_lint.out \ | |
6a441471 | 57 | subdir_distinfo \ |
28f540f4 | 58 | subdir_echo-headers subdir_echo-distinfo \ |
57ba7bb4 UD |
59 | subdir_install \ |
60 | $(addprefix install-, no-libc.a bin lib data headers others) | |
28f540f4 | 61 | \f |
5107cf1d | 62 | headers := errno.h sys/errno.h bits/errno.h limits.h values.h \ |
dc30f461 UD |
63 | features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h \ |
64 | gnu/libc-version.h | |
28f540f4 RM |
65 | |
66 | echo-headers: subdir_echo-headers | |
67 | ||
762a2918 UD |
68 | # The headers are in the include directory. |
69 | subdir-dirs = include | |
70 | vpath %.h $(subdir-dirs) | |
71 | ||
28f540f4 | 72 | # What to install. |
8d57beea | 73 | install-others = $(inst_includedir)/gnu/stubs.h |
56552e42 UD |
74 | install-bin = glibcbug |
75 | ||
a18f587d | 76 | ifeq (yes,$(build-shared)) |
c0e45674 | 77 | install-others += $(inst_includedir)/gnu/lib-names.h |
a18f587d | 78 | endif |
28f540f4 | 79 | |
28f540f4 RM |
80 | include Makerules |
81 | ||
737547be UD |
82 | ifeq ($(build-programs),yes) |
83 | others: $(addprefix $(objpfx),$(install-bin)) | |
84 | endif | |
85 | ||
28f540f4 RM |
86 | # Install from subdirectories too. |
87 | install: subdir_install | |
8d57beea | 88 | |
5148d49f UD |
89 | # Make sure that the dynamic linker is installed before libc. |
90 | $(inst_slibdir)/libc-$(version).so: elf/ldso_install | |
91 | ||
92 | .PHONY: elf/ldso_install | |
93 | elf/ldso_install: | |
94 | $(MAKE) -C $(@D) $(@F) | |
95 | ||
6973fc01 | 96 | # Create links for shared libraries using the `ldconfig' program is possible. |
7cc27f44 | 97 | # Ignore the error if we cannot update /etc/ld.so.cache. |
1ef32c3d UD |
98 | ifeq (no,$(cross-compiling)) |
99 | ifeq (yes,$(build-shared)) | |
409dfcea UD |
100 | install: install-symbolic-link |
101 | .PHONY: install-symbolic-link | |
102 | install-symbolic-link: subdir_install | |
9d141cae | 103 | $(symbolic-link-prog) $(symbolic-link-list) |
7ef90c15 | 104 | rm -f $(symbolic-link-list) |
9d141cae | 105 | |
8d57beea | 106 | install: |
7cc27f44 | 107 | -test ! -x $(common-objpfx)elf/ldconfig || \ |
1228ed5c | 108 | $(common-objpfx)elf/ldconfig -d $(inst_slibdir) $(inst_libdir) |
cc3fa755 UD |
109 | ifneq (no,$(PERL)) |
110 | ifeq (/usr,$(prefix)) | |
111 | ifeq (,$(install_root)) | |
5bc2f642 | 112 | CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx) |
cc3fa755 UD |
113 | endif |
114 | endif | |
115 | endif | |
1ef32c3d UD |
116 | endif |
117 | endif | |
28f540f4 | 118 | |
01a36ad3 RM |
119 | # Build subdirectory lib objects. |
120 | lib-noranlib: subdir_lib | |
28f540f4 | 121 | |
01a36ad3 RM |
122 | ifeq (yes,$(build-shared)) |
123 | # Build the shared object from the PIC object library. | |
124 | lib: $(common-objpfx)libc.so | |
125 | endif | |
28f540f4 | 126 | \f |
97a47867 UD |
127 | # Makerules creates a file `stubs' in each subdirectory, which |
128 | # contains `#define __stub_FUNCTION' for each function defined in that | |
129 | # directory which is a stub. | |
6bc31da0 | 130 | # Here we paste all of these together into <gnu/stubs.h>. |
28f540f4 | 131 | |
97a47867 | 132 | subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) |
28f540f4 RM |
133 | |
134 | # Since stubs.h is never needed when building the library, we simplify the | |
135 | # hairy installation process by producing it in place only as the last part | |
b9b49b44 UD |
136 | # of the top-level `make install'. It depends on subdir_install, which |
137 | # iterates over all the subdirs; subdir_install in each subdir depends on | |
138 | # the subdir's stubs file. Having more direct dependencies would result in | |
139 | # extra iterations over the list for subdirs and many recursive makes. | |
140 | $(inst_includedir)/gnu/stubs.h: subdir_install | |
5107cf1d | 141 | $(make-target-directory) |
28f540f4 RM |
142 | @rm -f $(objpfx)stubs.h |
143 | (echo '/* This file is automatically generated.';\ | |
144 | echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\ | |
145 | echo ' in the C library which is a stub, meaning it will fail';\ | |
146 | echo ' every time called, usually setting errno to ENOSYS. */';\ | |
b9b49b44 | 147 | sort $(subdir-stubs)) > $(objpfx)stubs.h |
13a0be88 | 148 | if test -r $@ && cmp -s $(objpfx)stubs.h $@; \ |
ba1ffaa1 | 149 | then echo 'stubs.h unchanged'; \ |
d36e7692 | 150 | else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi |
28f540f4 RM |
151 | rm -f $(objpfx)stubs.h |
152 | \f | |
8a523922 | 153 | ifeq (yes,$(build-shared)) |
afd4eb37 | 154 | |
73237de3 | 155 | $(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h $(+force) |
5107cf1d | 156 | $(make-target-directory) |
56552e42 UD |
157 | if test -r $@ && cmp -s $< $@; \ |
158 | then echo 'gnu/lib-names.h unchanged'; \ | |
159 | else $(INSTALL_DATA) $< $@; fi | |
afd4eb37 | 160 | endif |
ba1ffaa1 | 161 | \f |
df4ef2ab UD |
162 | # The `glibcbug' script contains the version number and it shall be rebuild |
163 | # whenever this changes or the `glibcbug.in' file. | |
5290baf0 | 164 | $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in |
af3878df | 165 | cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F) |
df4ef2ab | 166 | \f |
28f540f4 RM |
167 | # This makes the Info or DVI file of the documentation from the Texinfo source. |
168 | .PHONY: info dvi | |
169 | info dvi: | |
c0e45674 | 170 | $(MAKE) $(PARALLELMFLAGS) -C manual $@ |
28f540f4 RM |
171 | \f |
172 | # This makes all the subdirectory targets. | |
173 | ||
174 | # For each target, make it depend on DIR/target for each subdirectory DIR. | |
175 | $(+subdir_targets): %: $(addsuffix /%,$(subdirs)) | |
176 | ||
177 | # Compute a list of all those targets. | |
178 | all-subdirs-targets := $(foreach dir,$(subdirs),\ | |
179 | $(addprefix $(dir)/,$(+subdir_targets))) | |
180 | ||
181 | # The action for each of those is to cd into the directory and make the | |
182 | # target there. | |
183 | $(all-subdirs-targets): | |
c0e45674 | 184 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
28f540f4 RM |
185 | |
186 | .PHONY: $(+subdir_targets) $(all-subdirs-targets) | |
187 | \f | |
188 | # Targets to clean things up to various degrees. | |
189 | ||
190 | .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean | |
191 | ||
192 | # Subroutines of all cleaning targets. | |
193 | parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules. | |
4ddde9ee | 194 | -rm -f $(foreach o,$(object-suffixes-for-libc),\ |
60092701 RM |
195 | $(common-objpfx)$(patsubst %,$(libtype$o),c)) \ |
196 | $(addprefix $(objpfx),$(install-lib)) | |
28f540f4 | 197 | parent-clean: parent-mostlyclean common-clean |
da2d1bc5 UD |
198 | |
199 | postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \ | |
4ddde9ee UD |
200 | $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules) \ |
201 | $(objpfx)soversions.mk | |
28f540f4 RM |
202 | |
203 | clean: parent-clean | |
204 | # This is done this way rather than having `subdir_clean' be a | |
205 | # dependency of this target so that libc.a will be removed before the | |
206 | # subdirectories are dealt with and so they won't try to remove object | |
207 | # files from it when it's going to be removed anyway. | |
208 | @$(MAKE) subdir_clean no_deps=t | |
209 | mostlyclean: parent-mostlyclean | |
210 | @$(MAKE) subdir_mostlyclean no_deps=t | |
da2d1bc5 | 211 | -rm -f $(postclean) |
28f540f4 RM |
212 | |
213 | # The realclean target is just like distclean for the parent, but we want | |
214 | # the subdirs to know the difference in case they care. | |
215 | realclean distclean: parent-clean | |
216 | # This is done this way rather than having `subdir_distclean' be a | |
217 | # dependency of this target so that libc.a will be removed before the | |
218 | # subdirectories are dealt with and so they won't try to remove object | |
219 | # files from it when it's going to be removed anyway. | |
da2d1bc5 UD |
220 | @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \ |
221 | sysdep-subdirs="$(sysdep-subdirs)" | |
222 | -rm -f $(postclean) | |
28f540f4 RM |
223 | |
224 | # Subroutine of distclean and realclean. | |
225 | distclean-1: subdir_$(distclean-1) | |
226 | -rm -f $(config-generated) | |
60092701 RM |
227 | -rm -f $(addprefix $(objpfx),config.status config.cache config.log) |
228 | -rm -f $(addprefix $(objpfx),config.make config-name.h config.h) | |
9a0a462c | 229 | -rm -f $(addprefix $(objpfx),glibcbug) |
28f540f4 RM |
230 | ifdef objdir |
231 | -rm -f $(objpfx)Makefile | |
232 | endif | |
233 | -rm -f $(sysdep-$(distclean-1)) | |
234 | \f | |
235 | .PHONY: echo_subdirs | |
236 | echo_subdirs:;@echo '$(subdirs)' | |
237 | ||
238 | .PHONY: echo-distinfo parent_echo-distinfo | |
239 | echo-distinfo: parent_echo-distinfo subdir_echo-distinfo | |
240 | parent_echo-distinfo: | |
241 | @echo $(addprefix +header+,$(headers)) \ | |
242 | $(addprefix +nodist+,$(generated)) | |
6a441471 | 243 | |
2f6d1f1b | 244 | \f |
28f540f4 RM |
245 | # Make the distribution tarfile. |
246 | ||
a709dd43 UD |
247 | distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \ |
248 | PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \ | |
5bc2f642 | 249 | Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \ |
b0b67c47 UD |
250 | extra-lib.mk o-iterator.mk configure configure.in \ |
251 | aclocal.m4 config.h.in config.make.in config-name.in \ | |
252 | Makefile.in sysdep.h set-hooks.h libc-symbols.h \ | |
253 | version.h shlib-versions rpm/Makefile rpm/template \ | |
254 | rpm/rpmrc glibcbug.in abi-tags stub-tag.h \ | |
4bae5567 | 255 | test-skeleton.c include/des.h Versions.def \ |
5bc2f642 | 256 | $(addprefix scripts/, \ |
a709dd43 UD |
257 | rellns-sh config.sub config.guess \ |
258 | mkinstalldirs move-if-change install-sh \ | |
4bae5567 | 259 | test-installation.pl gen-FAQ.pl versions.awk) |
28f540f4 RM |
260 | |
261 | distribute := $(strip $(distribute)) | |
c7562c74 | 262 | generated := $(generated) stubs.h |
28f540f4 | 263 | |
8d57beea | 264 | README: README.template version.h ; # Make-dist should update README. |
28f540f4 RM |
265 | |
266 | define format-me | |
267 | @rm -f $@ | |
268 | makeinfo --no-validate --no-warn --no-headers $< -o $@ | |
269 | -chmod a-w $@ | |
270 | endef | |
a35cb74d | 271 | INSTALL: manual/install.texi; $(format-me) |
28f540f4 | 272 | NOTES: manual/creature.texi; $(format-me) |
714a562f | 273 | manual/dir-add.texi manual/dir-add.info: FORCE |
fe7bdd63 | 274 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
5bc2f642 | 275 | FAQ: scripts/gen-FAQ.pl FAQ.in |
61952351 | 276 | $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@ |
a35cb74d UD |
277 | ifeq ($(with-cvs),yes) |
278 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@ | |
279 | endif | |
f671aeab | 280 | FORCE: |
6a441471 RM |
281 | |
282 | rpm/%: subdir_distinfo | |
a709dd43 | 283 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
33a934a3 | 284 | |
f4017d20 UD |
285 | iconvdata/%: |
286 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) | |
287 | ||
33a934a3 UD |
288 | # This is a special goal for people making binary distributions. Normally |
289 | # everybody uses the DES based crypt library but for the distribution we | |
290 | # need the only-MD5 based one as well. | |
291 | md5-crypt/libmd5crypt: | |
c0e45674 | 292 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
a53bad16 UD |
293 | |
294 | # glibc 2.0 contains some header files which aren't used with glibc 2.1 | |
295 | # anymore. | |
296 | # These rules should remove those headers | |
297 | ifeq (,$(install_root)) | |
298 | ifeq ($(old-glibc-headers),yes) | |
299 | install: remove-old-headers | |
300 | endif | |
301 | endif | |
302 | ||
303 | headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \ | |
304 | errnos.h fcntlbits.h huge_val.h ioctl-types.h \ | |
305 | ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \ | |
306 | mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \ | |
307 | posix2_lim.h posix_opt.h resourcebits.h schedbits.h \ | |
308 | selectbits.h semaphorebits.h sigaction.h sigcontext.h \ | |
309 | signum.h sigset.h sockaddrcom.h socketbits.h stab.def \ | |
310 | statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \ | |
311 | syscall-list.h termbits.h timebits.h ustatbits.h \ | |
312 | utmpbits.h utsnamelen.h waitflags.h waitstatus.h \ | |
313 | xopen_lim.h gnu/types.h sys/ipc_buf.h \ | |
314 | sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \ | |
a7ab2023 | 315 | sys/shm_buf.h sys/socketcall.h sigstack.h |
a53bad16 | 316 | |
b195f6bc | 317 | .PHONY: remove-old-headers |
a53bad16 UD |
318 | remove-old-headers: |
319 | rm -f $(addprefix $(inst_includedir)/, $(headers2_0)) |