alpha: Fix tls-macros.h
[glibc.git] / Makefile
blob0c92e4f27f3f90db5b24e091db69dbd4f9708d0a
1 # Copyright (C) 1991-2013 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, see
16 # <http://www.gnu.org/licenses/>.
19 # Master Makefile for the GNU C library
21 ifneq (,)
22 This makefile requires GNU Make.
23 endif
25 include Makeconfig
28 # This is the default target; it makes everything except the tests.
29 .PHONY: all
30 all: lib others
32 ifneq ($(AUTOCONF),no)
34 define autoconf-it
35 @-rm -f $@.new
36 $(AUTOCONF) $(ACFLAGS) $< > $@.new
37 chmod a-w$(patsubst %,$(comma)a+x,$(filter .,$(@D))) $@.new
38 mv -f $@.new $@
39 endef
41 configure: configure.in aclocal.m4; $(autoconf-it)
42 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
43 %/preconfigure: %/preconfigure.in aclocal.m4; $(autoconf-it)
45 endif # $(AUTOCONF) = no
48 # We don't want to run anything here in parallel.
49 .NOTPARALLEL:
51 # These are the targets that are made by making them in each subdirectory.
52 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
53 subdir_clean subdir_distclean subdir_realclean \
54 tests xtests subdir_lint.out \
55 subdir_update-abi subdir_check-abi \
56 subdir_echo-headers \
57 subdir_install \
58 subdir_objs subdir_stubs subdir_testclean \
59 $(addprefix install-, no-libc.a bin lib data headers others)
61 headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
62 bits/xopen_lim.h gnu/libc-version.h stdc-predef.h
64 echo-headers: subdir_echo-headers
66 # The headers are in the include directory.
67 subdir-dirs = include
68 vpath %.h $(subdir-dirs)
70 # What to install.
71 install-others = $(inst_includedir)/gnu/stubs.h
72 install-bin-script =
74 ifeq (yes,$(build-shared))
75 headers += gnu/lib-names.h
76 endif
78 include Makerules
80 ifeq ($(build-programs),yes)
81 others: $(addprefix $(objpfx),$(install-bin-script))
82 endif
84 # Install from subdirectories too.
85 install: subdir_install
87 # Explicit dependency so that `make install-headers' works
88 install-headers: install-headers-nosubdir
90 # Make sure that the dynamic linker is installed before libc.
91 $(inst_slibdir)/libc-$(version).so: elf/ldso_install
93 .PHONY: elf/ldso_install
94 elf/ldso_install:
95 $(MAKE) -C $(@D) $(@F)
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)
107 install:
108 dont-bother-with-destdir:
109 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
110 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
111 $(slibdir) $(libdir)
112 ifneq (no,$(PERL))
113 ifeq (/usr,$(prefix))
114 ifeq (,$(install_root))
115 LD_SO=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
116 endif
117 endif
118 endif
119 endif
120 endif
122 # Build subdirectory lib objects.
123 lib-noranlib: subdir_lib
125 ifeq (yes,$(build-shared))
126 # Build the shared object from the PIC object library.
127 lib: $(common-objpfx)libc.so
129 lib: $(common-objpfx)linkobj/libc.so
131 # Do not filter ld.so out of libc.so link.
132 $(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
134 $(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
135 $(common-objpfx)linkobj/libc_pic.a \
136 $(elfobjdir)/sofini.os \
137 $(elfobjdir)/interp.os \
138 $(elfobjdir)/ld.so \
139 $(shlib-lds)
140 $(build-shlib)
142 $(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
143 $(common-objpfx)sunrpc/librpc_compat_pic.a
144 $(..)./scripts/mkinstalldirs $(common-objpfx)linkobj
145 (cd $(common-objpfx)linkobj; \
146 $(AR) x ../libc_pic.a; \
147 rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
148 $(AR) x ../sunrpc/librpc_compat_pic.a; \
149 $(AR) cr libc_pic.a *.os; \
150 rm *.os)
151 endif
154 # This is a handy script for running any dynamically linked program against
155 # the current libc build for testing.
156 $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
157 $(..)Makeconfig $(..)Makefile
158 (echo '#!/bin/sh'; \
159 echo 'builddir=`dirname "$$0"`'; \
160 echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
161 echo 'exec $(subst $(common-objdir),"$${builddir}",\
162 $(test-program-prefix)) $${1+"$$@"}'; \
163 ) > $@T
164 chmod a+x $@T
165 mv -f $@T $@
166 postclean-generated += testrun.sh
168 others: $(common-objpfx)testrun.sh
170 # Makerules creates a file `stubs' in each subdirectory, which
171 # contains `#define __stub_FUNCTION' for each function defined in that
172 # directory which is a stub.
173 # Here we paste all of these together into <gnu/stubs.h>.
175 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
177 ifndef abi-variants
178 installed-stubs = $(inst_includedir)/gnu/stubs.h
179 else
180 installed-stubs = $(inst_includedir)/gnu/stubs-$(default-abi).h
182 $(inst_includedir)/gnu/stubs.h: $(+force)
183 $(make-target-directory)
185 echo '/* This file is automatically generated.';\
186 echo " This file selects the right generated file of \`__stub_FUNCTION' macros";\
187 echo ' based on the architecture being compiled for. */'; \
188 echo ''; \
189 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
190 echo ''; \
191 $(foreach v,$(abi-variants),\
192 $(if $(abi-$(v)-condition),\
193 echo '#if $(abi-$(v)-condition)'; \
194 echo '# include <gnu/stubs-$(v).h>'); \
195 $(if $(abi-$(v)-condition),echo '#endif';) \
196 rm -f $(@:.d=.h).new$(v); \
198 } > $(@:.d=.h).new
199 mv -f $(@:.d=.h).new $(@:.d=.h)
201 install-others-nosubdir: $(installed-stubs)
202 endif
205 # Since stubs.h is never needed when building the library, we simplify the
206 # hairy installation process by producing it in place only as the last part
207 # of the top-level `make install'. It depends on subdir_install, which
208 # iterates over all the subdirs; subdir_install in each subdir depends on
209 # the subdir's stubs file. Having more direct dependencies would result in
210 # extra iterations over the list for subdirs and many recursive makes.
211 $(installed-stubs): include/stubs-prologue.h subdir_install
212 $(make-target-directory)
213 @rm -f $(objpfx)stubs.h
214 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
215 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
216 then echo 'stubs.h unchanged'; \
217 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
218 rm -f $(objpfx)stubs.h
220 # This makes the Info or DVI file of the documentation from the Texinfo source.
221 .PHONY: info dvi pdf html
222 info dvi pdf html:
223 $(MAKE) $(PARALLELMFLAGS) -C manual $@
225 # This makes all the subdirectory targets.
227 # For each target, make it depend on DIR/target for each subdirectory DIR.
228 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
230 # Compute a list of all those targets.
231 all-subdirs-targets := $(foreach dir,$(subdirs),\
232 $(addprefix $(dir)/,$(+subdir_targets)))
234 # The action for each of those is to cd into the directory and make the
235 # target there.
236 $(all-subdirs-targets):
237 $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
239 define subdir-target-args
240 subdir=$(@D)$(if $($(@D)-srcdir),\
241 -C $($(@D)-srcdir) ..=`pwd`/,\
242 -C $(@D) ..=../)
243 endef
245 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
247 # Targets to clean things up to various degrees.
249 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
250 tests-clean
252 # Subroutines of all cleaning targets.
253 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
254 -rm -f $(foreach o,$(object-suffixes-for-libc),\
255 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
256 $(addprefix $(objpfx),$(install-lib))
257 parent-clean: parent-mostlyclean common-clean
259 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
260 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
261 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
263 clean: parent-clean
264 # This is done this way rather than having `subdir_clean' be a
265 # dependency of this target so that libc.a will be removed before the
266 # subdirectories are dealt with and so they won't try to remove object
267 # files from it when it's going to be removed anyway.
268 @$(MAKE) subdir_clean no_deps=t
269 -rm -f $(postclean)
270 mostlyclean: parent-mostlyclean
271 @$(MAKE) subdir_mostlyclean no_deps=t
272 -rm -f $(postclean)
274 tests-clean:
275 @$(MAKE) subdir_testclean no_deps=t
277 tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
278 ifneq ($(CXX),no)
280 vpath c++-types.data $(+sysdep_dirs)
282 $(objpfx)c++-types-check.out: c++-types.data scripts/check-c++-types.sh
283 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@
284 endif
286 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
287 AWK='$(AWK)' scripts/check-local-headers.sh \
288 "$(includedir)" "$(objpfx)" > $@
290 ifneq ($(PERL),no)
291 installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
292 crypt/crypt.h ctype/ctype.h debug/execinfo.h \
293 dirent/dirent.h dlfcn/dlfcn.h elf/elf.h elf/link.h \
294 gmon/sys/gmon.h gmon/sys/gmon_out.h gmon/sys/profil.h \
295 grp/grp.h gshadow/gshadow.h iconv/iconv.h iconv/gconv.h \
296 $(wildcard inet/netinet/*.h) \
297 $(wildcard inet/arpa/*.h inet/protocols/*.h) \
298 inet/aliases.h inet/ifaddrs.h inet/netinet/ip6.h \
299 inet/netinet/icmp6.h intl/libintl.h io/sys/stat.h \
300 io/sys/statfs.h io/sys/vfs.h io/sys/statvfs.h \
301 io/fcntl.h io/sys/fcntl.h io/poll.h io/sys/poll.h \
302 io/utime.h io/ftw.h io/fts.h io/sys/sendfile.h \
303 libio/stdio.h libio/libio.h locale/locale.h \
304 locale/langinfo.h locale/xlocale.h login/utmp.h \
305 login/lastlog.h login/pty.h malloc/malloc.h \
306 malloc/obstack.h malloc/mcheck.h math/math.h \
307 math/complex.h math/fenv.h math/tgmath.h misc/sys/uio.h \
308 $(wildcard nis/rpcsvc/*.h) nptl_db/thread_db.h \
309 nptl/sysdeps/pthread/pthread.h nptl/semaphore.h \
310 nss/nss.h posix/sys/utsname.h posix/sys/times.h \
311 posix/sys/wait.h posix/sys/types.h posix/unistd.h \
312 posix/glob.h posix/regex.h posix/wordexp.h posix/fnmatch.h\
313 posix/getopt.h posix/tar.h posix/sys/unistd.h \
314 posix/sched.h posix/re_comp.h posix/wait.h \
315 posix/cpio.h posix/spawn.h pwd/pwd.h resolv/resolv.h \
316 resolv/netdb.h $(wildcard resolv/arpa/*.h) \
317 resource/sys/resource.h resource/sys/vlimit.h \
318 resource/sys/vtimes.h resource/ulimit.h rt/aio.h \
319 rt/mqueue.h setjmp/setjmp.h shadow/shadow.h \
320 signal/signal.h signal/sys/signal.h socket/sys/socket.h \
321 socket/sys/un.h stdio-common/printf.h \
322 stdio-common/stdio_ext.h stdlib/stdlib.h stdlib/alloca.h \
323 stdlib/monetary.h stdlib/fmtmsg.h stdlib/ucontext.h \
324 sysdeps/generic/inttypes.h sysdeps/generic/stdint.h \
325 stdlib/errno.h stdlib/sys/errno.h string/string.h \
326 string/strings.h string/memory.h string/endian.h \
327 string/argz.h string/envz.h string/byteswap.h \
328 $(wildcard sunrpc/rpc/*.h sunrpc/rpcsvc/*.h) \
329 sysvipc/sys/ipc.h sysvipc/sys/msg.h sysvipc/sys/sem.h \
330 sysvipc/sys/shm.h termios/termios.h \
331 termios/sys/termios.h termios/sys/ttychars.h time/time.h \
332 time/sys/time.h time/sys/timeb.h wcsmbs/wchar.h \
333 wctype/wctype.h
335 tests: $(objpfx)begin-end-check.out
336 $(objpfx)begin-end-check.out: scripts/begin-end-check.pl
337 $(PERL) scripts/begin-end-check.pl $(installed-headers) > $@
338 endif
340 # The realclean target is just like distclean for the parent, but we want
341 # the subdirs to know the difference in case they care.
342 realclean distclean: parent-clean
343 # This is done this way rather than having `subdir_distclean' be a
344 # dependency of this target so that libc.a will be removed before the
345 # subdirectories are dealt with and so they won't try to remove object
346 # files from it when it's going to be removed anyway.
347 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
348 sysdep-subdirs="$(sysdep-subdirs)"
349 -rm -f $(postclean)
351 # Subroutine of distclean and realclean.
352 distclean-1: subdir_$(distclean-1)
353 -rm -f $(config-generated)
354 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
355 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
356 ifdef objdir
357 -rm -f $(objpfx)Makefile
358 endif
359 -rm -f $(sysdep-$(distclean-1))
361 # Make the TAGS file for Emacs users.
363 .PHONY: TAGS
364 TAGS:
365 scripts/list-sources.sh | sed -n -e '/Makefile/p' \
366 $(foreach S,[chsSyl] cxx sh bash pl,\
367 $(subst .,\.,-e '/.$S\(.in\)*$$/p')) \
368 | $(ETAGS) -o $@ -
370 # Make the distribution tarfile.
371 .PHONY: dist dist-prepare
373 generated := $(generated) stubs.h
375 files-for-dist := README INSTALL configure ChangeLog NEWS
377 # Regenerate stuff, then error if these things are not committed yet.
378 dist-prepare: $(files-for-dist)
379 conf=`find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
380 -name configure`; \
381 $(MAKE) $$conf && \
382 git diff --stat HEAD -- $^ $$conf \
383 | $(AWK) '{ print; rc=1 } END { exit rc }'
385 %.tar: FORCE
386 git archive --prefix=$*/ $* > $@.new
387 mv -f $@.new $@
389 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
391 ifneq (,$(strip $(dist-version)))
392 dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
393 md5sum $^
394 else
395 dist: dist-prepare
396 @if v=`git describe`; then \
397 echo Distribution version $$v; \
398 $(MAKE) dist dist-version=$$v; \
399 else \
400 false; \
402 endif
404 INSTALL: manual/install.texi manual/macros.texi \
405 $(common-objpfx)manual/pkgvers.texi
406 makeinfo --no-validate --plaintext --no-number-sections \
407 -I$(common-objpfx)manual $< -o $@
408 -chmod a-w $@
409 $(common-objpfx)manual/%: FORCE
410 $(MAKE) $(PARALLELMFLAGS) -C manual $@
411 FORCE:
413 iconvdata/% localedata/% po/%: FORCE
414 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
416 # glibc 2.0 contains some header files which aren't used with glibc 2.1
417 # anymore.
418 # These rules should remove those headers
419 ifeq (,$(install_root))
420 ifeq ($(old-glibc-headers),yes)
421 install: remove-old-headers
422 endif
423 endif
425 headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
426 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
427 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
428 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
429 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
430 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
431 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
432 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
433 syscall-list.h termbits.h timebits.h ustatbits.h \
434 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
435 xopen_lim.h gnu/types.h sys/ipc_buf.h \
436 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
437 sys/shm_buf.h sys/socketcall.h sigstack.h
439 .PHONY: remove-old-headers
440 remove-old-headers:
441 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))