* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_load_address): Don't
[glibc.git] / Makefile
blob2e2a8af06c59e4d0a6ea9ac4742125235fe2ecfb
1 # Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
20 # Master Makefile for the GNU C library
22 ifneq (,)
23 This makefile requires GNU Make.
24 endif
26 include Makeconfig
29 # This is the default target; it makes everything except the tests.
30 .PHONY: all
31 all: lib others
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
50 # We don't want to run anything here in parallel.
51 .NOTPARALLEL:
53 configure: configure.in aclocal.m4; $(autoconf-it)
54 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
56 # These are the targets that are made by making them in each subdirectory.
57 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
58 subdir_clean subdir_distclean subdir_realclean \
59 tests xtests subdir_lint.out \
60 subdir_distinfo \
61 subdir_echo-headers subdir_echo-distinfo \
62 subdir_install \
63 subdir_testclean \
64 $(addprefix install-, no-libc.a bin lib data headers others)
66 headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
67 bits/xopen_lim.h gnu/libc-version.h
69 echo-headers: subdir_echo-headers
71 # The headers are in the include directory.
72 subdir-dirs = include
73 vpath %.h $(subdir-dirs)
75 # What to install.
76 install-others = $(inst_includedir)/gnu/stubs.h
77 install-bin-script = glibcbug
79 ifeq (yes,$(build-shared))
80 headers += gnu/lib-names.h
81 endif
83 include Makerules
85 ifeq ($(build-programs),yes)
86 others: $(addprefix $(objpfx),$(install-bin-script))
87 endif
89 # Install from subdirectories too.
90 install: subdir_install
92 # Explicit dependency so that `make install-headers' works
93 install-headers: install-headers-nosubdir
95 # Make sure that the dynamic linker is installed before libc.
96 $(inst_slibdir)/libc-$(version).so: elf/ldso_install
98 .PHONY: elf/ldso_install
99 elf/ldso_install:
100 $(MAKE) -C $(@D) $(@F)
102 # Create links for shared libraries using the `ldconfig' program if possible.
103 # Ignore the error if we cannot update /etc/ld.so.cache.
104 ifeq (no,$(cross-compiling))
105 ifeq (yes,$(build-shared))
106 install: install-symbolic-link
107 .PHONY: install-symbolic-link
108 install-symbolic-link: subdir_install
109 $(symbolic-link-prog) $(symbolic-link-list)
110 rm -f $(symbolic-link-list)
112 install:
113 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
114 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
115 $(slibdir) $(libdir)
116 ifneq (no,$(PERL))
117 ifeq (/usr,$(prefix))
118 ifeq (,$(install_root))
119 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
120 endif
121 endif
122 endif
123 endif
124 endif
126 # Build subdirectory lib objects.
127 lib-noranlib: subdir_lib
129 ifeq (yes,$(build-shared))
130 # Build the shared object from the PIC object library.
131 lib: $(common-objpfx)libc.so
132 endif
135 # This is a handy script for running any dynamically linked program against
136 # the current libc build for testing.
137 $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
138 $(..)Makeconfig $(..)Makefile
139 (echo '#!/bin/sh'; \
140 echo "GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
141 echo 'exec $(run-program-prefix) $${1+"$$@"}'; \
142 ) > $@T
143 chmod a+x $@T
144 mv -f $@T $@
145 postclean-generated += testrun.sh
147 others: $(common-objpfx)testrun.sh
149 # Makerules creates a file `stubs' in each subdirectory, which
150 # contains `#define __stub_FUNCTION' for each function defined in that
151 # directory which is a stub.
152 # Here we paste all of these together into <gnu/stubs.h>.
154 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
156 # Since stubs.h is never needed when building the library, we simplify the
157 # hairy installation process by producing it in place only as the last part
158 # of the top-level `make install'. It depends on subdir_install, which
159 # iterates over all the subdirs; subdir_install in each subdir depends on
160 # the subdir's stubs file. Having more direct dependencies would result in
161 # extra iterations over the list for subdirs and many recursive makes.
162 $(inst_includedir)/gnu/stubs.h: subdir_install
163 $(make-target-directory)
164 @rm -f $(objpfx)stubs.h
165 (echo '/* This file is automatically generated.';\
166 echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
167 echo ' in the C library which is a stub, meaning it will fail';\
168 echo ' every time called, usually setting errno to ENOSYS. */';\
169 LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
170 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
171 then echo 'stubs.h unchanged'; \
172 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
173 rm -f $(objpfx)stubs.h
175 # The `glibcbug' script contains the version number and it shall be rebuild
176 # whenever this changes or the `glibcbug.in' file.
177 $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
178 cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
180 # This makes the Info or DVI file of the documentation from the Texinfo source.
181 .PHONY: info dvi pdf html
182 info dvi pdf html:
183 $(MAKE) $(PARALLELMFLAGS) -C manual $@
185 # This makes all the subdirectory targets.
187 # For each target, make it depend on DIR/target for each subdirectory DIR.
188 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
190 # Compute a list of all those targets.
191 all-subdirs-targets := $(foreach dir,$(subdirs),\
192 $(addprefix $(dir)/,$(+subdir_targets)))
194 # The action for each of those is to cd into the directory and make the
195 # target there.
196 $(all-subdirs-targets):
197 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
199 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
201 # Targets to clean things up to various degrees.
203 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
204 tests-clean
206 # Subroutines of all cleaning targets.
207 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
208 -rm -f $(foreach o,$(object-suffixes-for-libc),\
209 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
210 $(addprefix $(objpfx),$(install-lib))
211 parent-clean: parent-mostlyclean common-clean
213 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
214 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
215 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
217 clean: parent-clean
218 # This is done this way rather than having `subdir_clean' be a
219 # dependency of this target so that libc.a will be removed before the
220 # subdirectories are dealt with and so they won't try to remove object
221 # files from it when it's going to be removed anyway.
222 @$(MAKE) subdir_clean no_deps=t
223 -rm -f $(postclean)
224 mostlyclean: parent-mostlyclean
225 @$(MAKE) subdir_mostlyclean no_deps=t
226 -rm -f $(postclean)
228 tests-clean:
229 @$(MAKE) subdir_testclean no_deps=t
231 # The realclean target is just like distclean for the parent, but we want
232 # the subdirs to know the difference in case they care.
233 realclean distclean: parent-clean
234 # This is done this way rather than having `subdir_distclean' be a
235 # dependency of this target so that libc.a will be removed before the
236 # subdirectories are dealt with and so they won't try to remove object
237 # files from it when it's going to be removed anyway.
238 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
239 sysdep-subdirs="$(sysdep-subdirs)"
240 -rm -f $(postclean)
242 # Subroutine of distclean and realclean.
243 distclean-1: subdir_$(distclean-1)
244 -rm -f $(config-generated)
245 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
246 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
247 -rm -f $(addprefix $(objpfx),glibcbug)
248 ifdef objdir
249 -rm -f $(objpfx)Makefile
250 endif
251 -rm -f $(sysdep-$(distclean-1))
253 .PHONY: echo_subdirs
254 echo_subdirs:;@echo '$(subdirs)'
256 .PHONY: echo-distinfo parent_echo-distinfo
257 echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
258 parent_echo-distinfo:
259 @echo $(addprefix +header+,$(headers)) \
260 $(addprefix +nodist+,$(generated))
263 # Make the distribution tarfile.
265 distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
266 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
267 ChangeLog.1[0-9] Makefile Makeconfig Makerules Rules \
268 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
269 configure.in aclocal.m4 config.h.in config.make.in \
270 config-name.in Makefile.in sysdep.h set-hooks.h \
271 libc-symbols.h version.h shlib-versions rpm/Makefile \
272 rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
273 test-skeleton.c include/des.h include/libc-internal.h \
274 include/shlib-compat.h include/pthread.h Versions.def \
275 cppflags-iterator.mk INTERFACE CONFORMANCE NAMESPACE \
276 LICENSES \
277 $(addprefix scripts/, \
278 rellns-sh config.sub config.guess \
279 mkinstalldirs move-if-change install-sh \
280 test-installation.pl gen-FAQ.pl versions.awk\
281 gen-sorted.awk abi-versions.awk \
282 firstversions.awk documented.sh cpp)
284 distribute := $(strip $(distribute))
285 generated := $(generated) stubs.h
287 README: README.template version.h
288 -rm -f $@
289 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
290 # Make it unwritable so I won't change it by mistake.
291 chmod 444 $@
292 ifeq ($(with-cvs),yes)
293 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
294 endif
296 define format-me
297 @rm -f $@
298 makeinfo --no-validate --no-warn --no-headers $< -o $@
299 -chmod a-w $@
300 endef
301 INSTALL: manual/install.texi; $(format-me)
302 NOTES: manual/creature.texi; $(format-me)
303 manual/dir-add.texi manual/dir-add.info: FORCE
304 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
305 FAQ: scripts/gen-FAQ.pl FAQ.in
306 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
307 ifeq ($(with-cvs),yes)
308 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
309 endif
310 FORCE:
312 rpm/%: subdir_distinfo
313 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
315 iconvdata/% localedata/% po/% manual/%:
316 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
318 # This is a special goal for people making binary distributions. Normally
319 # everybody uses the DES based crypt library but for the distribution we
320 # need the only-MD5 based one as well.
321 md5-crypt/libmd5crypt:
322 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
324 # glibc 2.0 contains some header files which aren't used with glibc 2.1
325 # anymore.
326 # These rules should remove those headers
327 ifeq (,$(install_root))
328 ifeq ($(old-glibc-headers),yes)
329 install: remove-old-headers
330 endif
331 endif
333 headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
334 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
335 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
336 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
337 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
338 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
339 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
340 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
341 syscall-list.h termbits.h timebits.h ustatbits.h \
342 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
343 xopen_lim.h gnu/types.h sys/ipc_buf.h \
344 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
345 sys/shm_buf.h sys/socketcall.h sigstack.h
347 .PHONY: remove-old-headers
348 remove-old-headers:
349 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))