* sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask): Declutter
[glibc.git] / Makefile
blob1c40af0506435794a202d2002d4f9e2e4c625886
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
134 # Makerules creates a file `stubs' in each subdirectory, which
135 # contains `#define __stub_FUNCTION' for each function defined in that
136 # directory which is a stub.
137 # Here we paste all of these together into <gnu/stubs.h>.
139 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
141 # Since stubs.h is never needed when building the library, we simplify the
142 # hairy installation process by producing it in place only as the last part
143 # of the top-level `make install'. It depends on subdir_install, which
144 # iterates over all the subdirs; subdir_install in each subdir depends on
145 # the subdir's stubs file. Having more direct dependencies would result in
146 # extra iterations over the list for subdirs and many recursive makes.
147 $(inst_includedir)/gnu/stubs.h: subdir_install
148 $(make-target-directory)
149 @rm -f $(objpfx)stubs.h
150 (echo '/* This file is automatically generated.';\
151 echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
152 echo ' in the C library which is a stub, meaning it will fail';\
153 echo ' every time called, usually setting errno to ENOSYS. */';\
154 LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
155 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
156 then echo 'stubs.h unchanged'; \
157 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
158 rm -f $(objpfx)stubs.h
160 # The `glibcbug' script contains the version number and it shall be rebuild
161 # whenever this changes or the `glibcbug.in' file.
162 $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
163 cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
165 # This makes the Info or DVI file of the documentation from the Texinfo source.
166 .PHONY: info dvi pdf html
167 info dvi pdf html:
168 $(MAKE) $(PARALLELMFLAGS) -C manual $@
170 # This makes all the subdirectory targets.
172 # For each target, make it depend on DIR/target for each subdirectory DIR.
173 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
175 # Compute a list of all those targets.
176 all-subdirs-targets := $(foreach dir,$(subdirs),\
177 $(addprefix $(dir)/,$(+subdir_targets)))
179 # The action for each of those is to cd into the directory and make the
180 # target there.
181 $(all-subdirs-targets):
182 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
184 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
186 # Targets to clean things up to various degrees.
188 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
189 tests-clean
191 # Subroutines of all cleaning targets.
192 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
193 -rm -f $(foreach o,$(object-suffixes-for-libc),\
194 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
195 $(addprefix $(objpfx),$(install-lib))
196 parent-clean: parent-mostlyclean common-clean
198 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
199 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
200 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
202 clean: parent-clean
203 # This is done this way rather than having `subdir_clean' be a
204 # dependency of this target so that libc.a will be removed before the
205 # subdirectories are dealt with and so they won't try to remove object
206 # files from it when it's going to be removed anyway.
207 @$(MAKE) subdir_clean no_deps=t
208 -rm -f $(postclean)
209 mostlyclean: parent-mostlyclean
210 @$(MAKE) subdir_mostlyclean no_deps=t
211 -rm -f $(postclean)
213 tests-clean:
214 @$(MAKE) subdir_testclean no_deps=t
216 # The realclean target is just like distclean for the parent, but we want
217 # the subdirs to know the difference in case they care.
218 realclean distclean: parent-clean
219 # This is done this way rather than having `subdir_distclean' be a
220 # dependency of this target so that libc.a will be removed before the
221 # subdirectories are dealt with and so they won't try to remove object
222 # files from it when it's going to be removed anyway.
223 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
224 sysdep-subdirs="$(sysdep-subdirs)"
225 -rm -f $(postclean)
227 # Subroutine of distclean and realclean.
228 distclean-1: subdir_$(distclean-1)
229 -rm -f $(config-generated)
230 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
231 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
232 -rm -f $(addprefix $(objpfx),glibcbug)
233 ifdef objdir
234 -rm -f $(objpfx)Makefile
235 endif
236 -rm -f $(sysdep-$(distclean-1))
238 .PHONY: echo_subdirs
239 echo_subdirs:;@echo '$(subdirs)'
241 .PHONY: echo-distinfo parent_echo-distinfo
242 echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
243 parent_echo-distinfo:
244 @echo $(addprefix +header+,$(headers)) \
245 $(addprefix +nodist+,$(generated))
248 # Make the distribution tarfile.
250 distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
251 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
252 ChangeLog.1[0-9] Makefile Makeconfig Makerules Rules \
253 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
254 configure.in aclocal.m4 config.h.in config.make.in \
255 config-name.in Makefile.in sysdep.h set-hooks.h \
256 libc-symbols.h version.h shlib-versions rpm/Makefile \
257 rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
258 test-skeleton.c include/des.h include/libc-internal.h \
259 include/shlib-compat.h include/pthread.h Versions.def \
260 cppflags-iterator.mk INTERFACE CONFORMANCE NAMESPACE \
261 LICENSES \
262 $(addprefix scripts/, \
263 rellns-sh config.sub config.guess \
264 mkinstalldirs move-if-change install-sh \
265 test-installation.pl gen-FAQ.pl versions.awk\
266 gen-sorted.awk abi-versions.awk \
267 firstversions.awk documented.sh cpp)
269 distribute := $(strip $(distribute))
270 generated := $(generated) stubs.h
272 README: README.template version.h
273 -rm -f $@
274 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
275 # Make it unwritable so I won't change it by mistake.
276 chmod 444 $@
277 ifeq ($(with-cvs),yes)
278 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
279 endif
281 define format-me
282 @rm -f $@
283 makeinfo --no-validate --no-warn --no-headers $< -o $@
284 -chmod a-w $@
285 endef
286 INSTALL: manual/install.texi; $(format-me)
287 NOTES: manual/creature.texi; $(format-me)
288 manual/dir-add.texi manual/dir-add.info: FORCE
289 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
290 FAQ: scripts/gen-FAQ.pl FAQ.in
291 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
292 ifeq ($(with-cvs),yes)
293 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
294 endif
295 FORCE:
297 rpm/%: subdir_distinfo
298 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
300 iconvdata/% localedata/% po/%:
301 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
303 # This is a special goal for people making binary distributions. Normally
304 # everybody uses the DES based crypt library but for the distribution we
305 # need the only-MD5 based one as well.
306 md5-crypt/libmd5crypt:
307 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
309 # glibc 2.0 contains some header files which aren't used with glibc 2.1
310 # anymore.
311 # These rules should remove those headers
312 ifeq (,$(install_root))
313 ifeq ($(old-glibc-headers),yes)
314 install: remove-old-headers
315 endif
316 endif
318 headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
319 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
320 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
321 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
322 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
323 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
324 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
325 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
326 syscall-list.h termbits.h timebits.h ustatbits.h \
327 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
328 xopen_lim.h gnu/types.h sys/ipc_buf.h \
329 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
330 sys/shm_buf.h sys/socketcall.h sigstack.h
332 .PHONY: remove-old-headers
333 remove-old-headers:
334 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))