Remove support in configure for unsupported architectures
[glibc.git] / Makefile
blob08134e9195097d48ced23059e4bf80350797fdc0
1 # Copyright (C) 1991-2002,2003,2004,2005,2006,2008,2009,2011
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, write to the Free
17 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 # 02111-1307 USA.
21 # Master Makefile for the GNU C library
23 ifneq (,)
24 This makefile requires GNU Make.
25 endif
27 include Makeconfig
30 # This is the default target; it makes everything except the tests.
31 .PHONY: all
32 all: lib others
34 ifneq ($(AUTOCONF),no)
36 define autoconf-it
37 @-rm -f $@.new
38 $(AUTOCONF) $(ACFLAGS) $< > $@.new
39 chmod a-w$(patsubst %,$(comma)a+x,$(filter .,$(@D))) $@.new
40 mv -f $@.new $@
41 endef
43 configure: configure.in aclocal.m4; $(autoconf-it)
44 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
45 %/preconfigure: %/preconfigure.in aclocal.m4; $(autoconf-it)
47 endif # $(AUTOCONF) = no
50 # We don't want to run anything here in parallel.
51 .NOTPARALLEL:
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 xtests subdir_lint.out \
57 subdir_update-abi subdir_check-abi \
58 subdir_echo-headers \
59 subdir_install \
60 subdir_objs subdir_stubs subdir_testclean \
61 $(addprefix install-, no-libc.a bin lib data headers others)
63 headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
64 bits/xopen_lim.h gnu/libc-version.h
66 echo-headers: subdir_echo-headers
68 # The headers are in the include directory.
69 subdir-dirs = include
70 vpath %.h $(subdir-dirs)
72 # What to install.
73 install-others = $(inst_includedir)/gnu/stubs.h
74 install-bin-script =
76 ifeq (yes,$(build-shared))
77 headers += gnu/lib-names.h
78 endif
80 include Makerules
82 ifeq ($(build-programs),yes)
83 others: $(addprefix $(objpfx),$(install-bin-script))
84 endif
86 # Install from subdirectories too.
87 install: subdir_install
89 # Explicit dependency so that `make install-headers' works
90 install-headers: install-headers-nosubdir
92 # Make sure that the dynamic linker is installed before libc.
93 $(inst_slibdir)/libc-$(version).so: elf/ldso_install
95 .PHONY: elf/ldso_install
96 elf/ldso_install:
97 $(MAKE) -C $(@D) $(@F)
99 # Create links for shared libraries using the `ldconfig' program if possible.
100 # Ignore the error if we cannot update /etc/ld.so.cache.
101 ifeq (no,$(cross-compiling))
102 ifeq (yes,$(build-shared))
103 install: install-symbolic-link
104 .PHONY: install-symbolic-link
105 install-symbolic-link: subdir_install
106 $(symbolic-link-prog) $(symbolic-link-list)
107 rm -f $(symbolic-link-list)
109 install:
110 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
111 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
112 $(slibdir) $(libdir)
113 ifneq (no,$(PERL))
114 ifeq (/usr,$(prefix))
115 ifeq (,$(install_root))
116 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
117 endif
118 endif
119 endif
120 endif
121 endif
123 # Build subdirectory lib objects.
124 lib-noranlib: subdir_lib
126 ifeq (yes,$(build-shared))
127 # Build the shared object from the PIC object library.
128 lib: $(common-objpfx)libc.so
130 lib: $(common-objpfx)linkobj/libc.so
132 $(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
133 $(common-objpfx)linkobj/libc_pic.a \
134 $(elfobjdir)/sofini.os \
135 $(elfobjdir)/interp.os \
136 $(elfobjdir)/ld.so \
137 $(shlib-lds)
138 $(build-shlib)
140 $(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
141 $(common-objpfx)sunrpc/librpc_compat_pic.a
142 $(..)./scripts/mkinstalldirs $(common-objpfx)linkobj
143 (cd $(common-objpfx)linkobj; \
144 $(AR) x ../libc_pic.a; \
145 rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
146 $(AR) x ../sunrpc/librpc_compat_pic.a; \
147 $(AR) cr libc_pic.a *.os; \
148 rm *.os)
149 endif
152 # This is a handy script for running any dynamically linked program against
153 # the current libc build for testing.
154 $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
155 $(..)Makeconfig $(..)Makefile
156 (echo '#!/bin/sh'; \
157 echo 'builddir=`dirname "$$0"`'; \
158 echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
159 echo 'exec $(subst $(common-objdir),"$${builddir}",\
160 $(run-program-prefix)) $${1+"$$@"}'; \
161 ) > $@T
162 chmod a+x $@T
163 mv -f $@T $@
164 postclean-generated += testrun.sh
166 others: $(common-objpfx)testrun.sh
168 # Makerules creates a file `stubs' in each subdirectory, which
169 # contains `#define __stub_FUNCTION' for each function defined in that
170 # directory which is a stub.
171 # Here we paste all of these together into <gnu/stubs.h>.
173 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
175 ifeq ($(biarch),no)
176 installed-stubs = $(inst_includedir)/gnu/stubs.h
177 else
178 installed-stubs = $(inst_includedir)/gnu/stubs-$(biarch).h
180 $(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
181 $(make-target-directory)
182 $(INSTALL_DATA) $< $@
184 install-others-nosubdir: $(installed-stubs)
185 endif
188 # Since stubs.h is never needed when building the library, we simplify the
189 # hairy installation process by producing it in place only as the last part
190 # of the top-level `make install'. It depends on subdir_install, which
191 # iterates over all the subdirs; subdir_install in each subdir depends on
192 # the subdir's stubs file. Having more direct dependencies would result in
193 # extra iterations over the list for subdirs and many recursive makes.
194 $(installed-stubs): include/stubs-prologue.h subdir_install
195 $(make-target-directory)
196 @rm -f $(objpfx)stubs.h
197 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
198 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
199 then echo 'stubs.h unchanged'; \
200 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
201 rm -f $(objpfx)stubs.h
203 # This makes the Info or DVI file of the documentation from the Texinfo source.
204 .PHONY: info dvi pdf html
205 info dvi pdf html:
206 $(MAKE) $(PARALLELMFLAGS) -C manual $@
208 # This makes all the subdirectory targets.
210 # For each target, make it depend on DIR/target for each subdirectory DIR.
211 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
213 # Compute a list of all those targets.
214 all-subdirs-targets := $(foreach dir,$(subdirs),\
215 $(addprefix $(dir)/,$(+subdir_targets)))
217 # The action for each of those is to cd into the directory and make the
218 # target there.
219 $(all-subdirs-targets):
220 $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
222 define subdir-target-args
223 subdir=$(@D)$(if $($(@D)-srcdir),\
224 -C $($(@D)-srcdir) ..=`pwd`/,\
225 -C $(@D) ..=../)
226 endef
228 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
230 # Targets to clean things up to various degrees.
232 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
233 tests-clean
235 # Subroutines of all cleaning targets.
236 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
237 -rm -f $(foreach o,$(object-suffixes-for-libc),\
238 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
239 $(addprefix $(objpfx),$(install-lib))
240 parent-clean: parent-mostlyclean common-clean
242 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
243 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
244 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
246 clean: parent-clean
247 # This is done this way rather than having `subdir_clean' be a
248 # dependency of this target so that libc.a will be removed before the
249 # subdirectories are dealt with and so they won't try to remove object
250 # files from it when it's going to be removed anyway.
251 @$(MAKE) subdir_clean no_deps=t
252 -rm -f $(postclean)
253 mostlyclean: parent-mostlyclean
254 @$(MAKE) subdir_mostlyclean no_deps=t
255 -rm -f $(postclean)
257 tests-clean:
258 @$(MAKE) subdir_testclean no_deps=t
260 tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
261 ifneq ($(CXX),no)
262 check-data := $(firstword $(wildcard \
263 $(foreach D,$(add-ons) scripts,\
264 $(patsubst %,$D/data/c++-types-%.data,\
265 $(abi-name) \
266 $(addsuffix -$(config-os),\
267 $(config-machine) \
268 $(base-machine))))))
269 ifneq (,$(check-data))
270 $(objpfx)c++-types-check.out: $(check-data) scripts/check-c++-types.sh
271 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@
272 else
273 $(objpfx)c++-types-check.out:
274 @echo 'WARNING C++ tests not run; create a c++-types-XXX file'
275 @echo "not run" > $@
276 endif
277 endif
279 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
280 AWK='$(AWK)' scripts/check-local-headers.sh \
281 "$(includedir)" "$(objpfx)" > $@
283 ifneq ($(PERL),no)
284 installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
285 crypt/crypt.h ctype/ctype.h debug/execinfo.h \
286 dirent/dirent.h dlfcn/dlfcn.h elf/elf.h elf/link.h \
287 gmon/sys/gmon.h gmon/sys/gmon_out.h gmon/sys/profil.h \
288 grp/grp.h gshadow/gshadow.h iconv/iconv.h iconv/gconv.h \
289 $(wildcard inet/netinet/*.h) \
290 $(wildcard inet/arpa/*.h inet/protocols/*.h) \
291 inet/aliases.h inet/ifaddrs.h inet/netinet/ip6.h \
292 inet/netinet/icmp6.h intl/libintl.h io/sys/stat.h \
293 io/sys/statfs.h io/sys/vfs.h io/sys/statvfs.h \
294 io/fcntl.h io/sys/fcntl.h io/poll.h io/sys/poll.h \
295 io/utime.h io/ftw.h io/fts.h io/sys/sendfile.h \
296 libio/stdio.h libio/libio.h locale/locale.h \
297 locale/langinfo.h locale/xlocale.h login/utmp.h \
298 login/lastlog.h login/pty.h malloc/malloc.h \
299 malloc/obstack.h malloc/mcheck.h math/math.h \
300 math/complex.h math/fenv.h math/tgmath.h misc/sys/uio.h \
301 $(wildcard nis/rpcsvc/*.h) nptl_db/thread_db.h \
302 nptl/sysdeps/pthread/pthread.h nptl/semaphore.h \
303 nss/nss.h posix/sys/utsname.h posix/sys/times.h \
304 posix/sys/wait.h posix/sys/types.h posix/unistd.h \
305 posix/glob.h posix/regex.h posix/wordexp.h posix/fnmatch.h\
306 posix/getopt.h posix/tar.h posix/sys/unistd.h \
307 posix/sched.h posix/re_comp.h posix/wait.h \
308 posix/cpio.h posix/spawn.h pwd/pwd.h resolv/resolv.h \
309 resolv/netdb.h $(wildcard resolv/arpa/*.h) \
310 resource/sys/resource.h resource/sys/vlimit.h \
311 resource/sys/vtimes.h resource/ulimit.h rt/aio.h \
312 rt/mqueue.h setjmp/setjmp.h shadow/shadow.h \
313 signal/signal.h signal/sys/signal.h socket/sys/socket.h \
314 socket/sys/un.h stdio-common/printf.h \
315 stdio-common/stdio_ext.h stdlib/stdlib.h stdlib/alloca.h \
316 stdlib/monetary.h stdlib/fmtmsg.h stdlib/ucontext.h \
317 sysdeps/generic/inttypes.h sysdeps/generic/stdint.h \
318 stdlib/errno.h stdlib/sys/errno.h string/string.h \
319 string/strings.h string/memory.h string/endian.h \
320 string/argz.h string/envz.h string/byteswap.h \
321 $(wildcard sunrpc/rpc/*.h sunrpc/rpcsvc/*.h) \
322 sysvipc/sys/ipc.h sysvipc/sys/msg.h sysvipc/sys/sem.h \
323 sysvipc/sys/shm.h termios/termios.h \
324 termios/sys/termios.h termios/sys/ttychars.h time/time.h \
325 time/sys/time.h time/sys/timeb.h wcsmbs/wchar.h \
326 wctype/wctype.h
328 tests: $(objpfx)begin-end-check.out
329 $(objpfx)begin-end-check.out: scripts/begin-end-check.pl
330 $(PERL) scripts/begin-end-check.pl $(installed-headers) > $@
331 endif
333 # The realclean target is just like distclean for the parent, but we want
334 # the subdirs to know the difference in case they care.
335 realclean distclean: parent-clean
336 # This is done this way rather than having `subdir_distclean' be a
337 # dependency of this target so that libc.a will be removed before the
338 # subdirectories are dealt with and so they won't try to remove object
339 # files from it when it's going to be removed anyway.
340 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
341 sysdep-subdirs="$(sysdep-subdirs)"
342 -rm -f $(postclean)
344 # Subroutine of distclean and realclean.
345 distclean-1: subdir_$(distclean-1)
346 -rm -f $(config-generated)
347 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
348 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
349 ifdef objdir
350 -rm -f $(objpfx)Makefile
351 endif
352 -rm -f $(sysdep-$(distclean-1))
354 # Make the TAGS file for Emacs users.
356 .PHONY: TAGS
357 TAGS:
358 scripts/list-sources.sh | sed -n -e '/Makefile/p' \
359 $(foreach S,[chsSyl] cxx sh bash pl,\
360 $(subst .,\.,-e '/.$S\(.in\)*$$/p')) \
361 | $(ETAGS) -o $@ -
363 # Make the distribution tarfile.
364 .PHONY: dist dist-prepare
366 generated := $(generated) stubs.h
368 files-for-dist := README FAQ INSTALL NOTES configure ChangeLog NEWS
370 # Regenerate stuff, then error if these things are not committed yet.
371 dist-prepare: $(files-for-dist)
372 conf=`find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
373 -name configure`; \
374 $(MAKE) $$conf && \
375 git diff --stat HEAD -- $^ $$conf \
376 | $(AWK) '{ print; rc=1 } END { exit rc }'
378 %.tar: FORCE
379 git archive --prefix=$*/ $* > $@.new
380 mv -f $@.new $@
382 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
384 ifneq (,$(strip $(dist-version)))
385 dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
386 md5sum $^
387 else
388 dist: dist-prepare
389 @if v=`git describe`; then \
390 echo Distribution version $$v; \
391 $(MAKE) dist dist-version=$$v; \
392 else \
393 false; \
395 endif
397 define format-me
398 @rm -f $@
399 makeinfo --no-validate --plaintext --no-number-sections $< -o $@
400 -chmod a-w $@
401 endef
402 INSTALL: manual/install.texi; $(format-me)
403 NOTES: manual/creature.texi; $(format-me)
404 manual/dir-add.texi manual/dir-add.info: FORCE
405 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
406 FAQ: scripts/gen-FAQ.pl FAQ.in
407 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
408 FORCE:
410 iconvdata/% localedata/% po/% manual/%: FORCE
411 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
413 # glibc 2.0 contains some header files which aren't used with glibc 2.1
414 # anymore.
415 # These rules should remove those headers
416 ifeq (,$(install_root))
417 ifeq ($(old-glibc-headers),yes)
418 install: remove-old-headers
419 endif
420 endif
422 headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
423 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
424 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
425 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
426 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
427 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
428 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
429 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
430 syscall-list.h termbits.h timebits.h ustatbits.h \
431 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
432 xopen_lim.h gnu/types.h sys/ipc_buf.h \
433 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
434 sys/shm_buf.h sys/socketcall.h sigstack.h
436 .PHONY: remove-old-headers
437 remove-old-headers:
438 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))