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