1 # Copyright (C) 1991-1999, 2000, 2001 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 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.
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.
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.
20 # Master Makefile for the GNU C library
23 This makefile requires GNU Make.
29 # This is the default target; it makes everything except the tests.
33 ifeq ($(with-cvs
),yes
)
36 autoconf
$(ACFLAGS
) $< > $@.new
39 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: autoconf $(ACFLAGS) $<' $@
44 autoconf
$(ACFLAGS
) $< > $@.new
50 # We don't want to run anything here in parallel.
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 subdir_lint.out \
61 subdir_echo-headers subdir_echo-distinfo \
64 $(addprefix install-
, no-libc.a bin lib data headers others
)
66 headers
:= errno.h sys
/errno.h bits
/errno.h limits.h values.h \
67 features.h gnu-versions.h bits
/libc-lock.h bits
/xopen_lim.h \
70 echo-headers
: subdir_echo-headers
72 # The headers are in the include directory.
74 vpath
%.h
$(subdir-dirs
)
77 install-others
= $(inst_includedir
)/gnu
/stubs.h
78 install-bin
= glibcbug
80 ifeq (yes
,$(build-shared
))
81 install-others
+= $(inst_includedir
)/gnu
/lib-names.h
86 ifeq ($(build-programs
),yes
)
87 others
: $(addprefix $(objpfx
),$(install-bin
))
90 # Install from subdirectories too.
91 install: subdir_install
93 # Make sure that the dynamic linker is installed before libc.
94 $(inst_slibdir
)/libc-
$(version
).so
: elf
/ldso_install
96 .PHONY
: elf
/ldso_install
98 $(MAKE
) -C
$(@D
) $(@F
)
100 # Create links for shared libraries using the `ldconfig' program if possible.
101 # Ignore the error if we cannot update /etc/ld.so.cache.
102 ifeq (no
,$(cross-compiling
))
103 ifeq (yes
,$(build-shared
))
104 install: install-symbolic-link
105 .PHONY
: install-symbolic-link
106 install-symbolic-link
: subdir_install
107 $(symbolic-link-prog
) $(symbolic-link-list
)
108 rm -f
$(symbolic-link-list
)
111 -test ! -x
$(common-objpfx
)elf
/ldconfig || LC_ALL
=C LANGUAGE
=C \
112 $(common-objpfx
)elf
/ldconfig
$(addprefix -r
,$(install_root
)) \
115 ifeq (/usr
,$(prefix))
116 ifeq (,$(install_root
))
117 CC
="$(CC)" $(PERL
) scripts
/test-installation.pl
$(common-objpfx
)
124 # Build subdirectory lib objects.
125 lib-noranlib
: subdir_lib
127 ifeq (yes
,$(build-shared
))
128 # Build the shared object from the PIC object library.
129 lib
: $(common-objpfx
)libc.so
132 # Makerules creates a file `stubs' in each subdirectory, which
133 # contains `#define __stub_FUNCTION' for each function defined in that
134 # directory which is a stub.
135 # Here we paste all of these together into <gnu/stubs.h>.
137 subdir-stubs
:= $(foreach dir,$(subdirs
),$(common-objpfx
)$(dir)/stubs
)
139 # Since stubs.h is never needed when building the library, we simplify the
140 # hairy installation process by producing it in place only as the last part
141 # of the top-level `make install'. It depends on subdir_install, which
142 # iterates over all the subdirs; subdir_install in each subdir depends on
143 # the subdir's stubs file. Having more direct dependencies would result in
144 # extra iterations over the list for subdirs and many recursive makes.
145 $(inst_includedir
)/gnu
/stubs.h
: subdir_install
146 $(make-target-directory
)
147 @
rm -f
$(objpfx
)stubs.h
148 (echo
'/* This file is automatically generated.';\
149 echo
' It defines a symbol `__stub_FUNCTION'\'' for each function';\
150 echo
' in the C library which is a stub, meaning it will fail';\
151 echo
' every time called, usually setting errno to ENOSYS. */';\
152 LC_ALL
=C
sort $(subdir-stubs
)) > $(objpfx
)stubs.h
153 if
test -r
$@
&& cmp
-s
$(objpfx
)stubs.h
$@
; \
154 then echo
'stubs.h unchanged'; \
155 else $(INSTALL_DATA
) $(objpfx
)stubs.h
$@
; fi
156 rm -f
$(objpfx
)stubs.h
158 ifeq (yes
,$(build-shared
))
160 $(inst_includedir
)/gnu
/lib-names.h
: $(common-objpfx
)gnu
/lib-names.h
$(+force)
164 # The `glibcbug' script contains the version number and it shall be rebuild
165 # whenever this changes or the `glibcbug.in' file.
166 $(objpfx
)glibcbug
: $(common-objpfx
)config.status glibcbug.in
167 cd
$(<D
) && CONFIG_FILES
=$(@F
) CONFIG_HEADERS
= $(SHELL
) $(<F
)
169 # This makes the Info or DVI file of the documentation from the Texinfo source.
172 $(MAKE
) $(PARALLELMFLAGS
) -C manual
$@
174 # This makes all the subdirectory targets.
176 # For each target, make it depend on DIR/target for each subdirectory DIR.
177 $(+subdir_targets
): %: $(addsuffix /%,$(subdirs
))
179 # Compute a list of all those targets.
180 all-subdirs-targets
:= $(foreach dir,$(subdirs
),\
181 $(addprefix $(dir)/,$(+subdir_targets
)))
183 # The action for each of those is to cd into the directory and make the
185 $(all-subdirs-targets
):
186 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
188 .PHONY
: $(+subdir_targets
) $(all-subdirs-targets
)
190 # Targets to clean things up to various degrees.
192 .PHONY
: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
195 # Subroutines of all cleaning targets.
196 parent-mostlyclean
: common-mostlyclean
# common-mostlyclean is in Makerules.
197 -rm -f
$(foreach o
,$(object-suffixes-for-libc
),\
198 $(common-objpfx
)$(patsubst %,$(libtype
$o),c
)) \
199 $(addprefix $(objpfx
),$(install-lib
))
200 parent-clean
: parent-mostlyclean common-clean
202 postclean
= $(addprefix $(common-objpfx
),$(postclean-generated
)) \
203 $(addprefix $(objpfx
),sysd-Makefile sysd-dirs sysd-rules
) \
204 $(addprefix $(objpfx
),sysd-sorted soversions.mk soversions.i
)
207 # This is done this way rather than having `subdir_clean' be a
208 # dependency of this target so that libc.a will be removed before the
209 # subdirectories are dealt with and so they won't try to remove object
210 # files from it when it's going to be removed anyway.
211 @
$(MAKE
) subdir_clean no_deps
=t
213 mostlyclean: parent-mostlyclean
214 @
$(MAKE
) subdir_mostlyclean no_deps
=t
218 @
$(MAKE
) subdir_testclean no_deps
=t
220 # The realclean target is just like distclean for the parent, but we want
221 # the subdirs to know the difference in case they care.
222 realclean distclean: parent-clean
223 # This is done this way rather than having `subdir_distclean' be a
224 # dependency of this target so that libc.a will be removed before the
225 # subdirectories are dealt with and so they won't try to remove object
226 # files from it when it's going to be removed anyway.
227 @
$(MAKE
) distclean-1 no_deps
=t distclean-1
=$@ avoid-generated
=yes \
228 sysdep-subdirs
="$(sysdep-subdirs)"
231 # Subroutine of distclean and realclean.
232 distclean-1
: subdir_
$(distclean-1
)
233 -rm -f
$(config-generated
)
234 -rm -f
$(addprefix $(objpfx
),config.status config.cache config.log
)
235 -rm -f
$(addprefix $(objpfx
),config.make config-name.h config.h
)
236 -rm -f
$(addprefix $(objpfx
),glibcbug
)
238 -rm -f
$(objpfx
)Makefile
240 -rm -f
$(sysdep-
$(distclean-1
))
243 echo_subdirs
:;@echo
'$(subdirs)'
245 .PHONY
: echo-distinfo parent_echo-distinfo
246 echo-distinfo
: parent_echo-distinfo subdir_echo-distinfo
247 parent_echo-distinfo
:
248 @echo
$(addprefix +header
+,$(headers
)) \
249 $(addprefix +nodist
+,$(generated
))
252 # Make the distribution tarfile.
254 distribute
:= README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
255 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.
[0-9] \
256 ChangeLog
.1[0-9] Makefile Makeconfig Makerules Rules \
257 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
258 configure.in aclocal.m4 config.h.in config.make.in \
259 config-name.in Makefile.in sysdep.h set-hooks.h \
260 libc-symbols.h version.h shlib-versions rpm
/Makefile \
261 rpm
/template rpm
/rpmrc glibcbug.in abi-tags stub-tag.h \
262 test-skeleton.c
include/des.h
include/libc-internal.h \
263 include/shlib-compat.h Versions.def \
264 INTERFACE CONFORMANCE NAMESPACE \
265 $(addprefix scripts
/, \
266 rellns-sh config.sub config.guess \
267 mkinstalldirs move-if-change install-sh \
268 test-installation.pl gen-FAQ.pl versions.awk\
269 gen-sorted.awk abi-versions.awk \
272 distribute
:= $(strip $(distribute
))
273 generated
:= $(generated
) stubs.h
275 README
: README.template version.h
277 sed
-e
's/RELEASE/$(release)/' -e
's/VERSION/$(version)/' < $< > $@
278 # Make it unwritable so I won't change it by mistake.
280 ifeq ($(with-cvs
),yes
)
281 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Remade for $(release)-$(version)' $@
286 makeinfo --no-validate
--no-warn
--no-headers
$< -o
$@
289 INSTALL
: manual
/install.texi
; $(format-me
)
290 NOTES
: manual
/creature.texi
; $(format-me
)
291 manual
/dir-add.texi manual
/dir-add.
info: FORCE
292 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
293 FAQ
: scripts
/gen-FAQ.pl FAQ.in
294 $(PERL
) $^
> $@.new
&& rm -f
$@
&& mv
$@.new
$@
&& chmod a-w
$@
295 ifeq ($(with-cvs
),yes
)
296 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: $(PERL) $^' $@
300 rpm
/%: subdir_distinfo
301 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
303 iconvdata
/% localedata
/% po
/%:
304 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
306 # This is a special goal for people making binary distributions. Normally
307 # everybody uses the DES based crypt library but for the distribution we
308 # need the only-MD5 based one as well.
309 md5-crypt
/libmd5crypt
:
310 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
312 # glibc 2.0 contains some header files which aren't used with glibc 2.1
314 # These rules should remove those headers
315 ifeq (,$(install_root
))
316 ifeq ($(old-glibc-headers
),yes
)
317 install: remove-old-headers
321 headers2_0
:= __math.h bytesex.h confname.h direntry.h elfclass.h \
322 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
323 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
324 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
325 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
326 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
327 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
328 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
329 syscall-list.h termbits.h timebits.h ustatbits.h \
330 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
331 xopen_lim.h gnu
/types.h sys
/ipc_buf.h \
332 sys
/kernel_termios.h sys
/msq_buf.h sys
/sem_buf.h \
333 sys
/shm_buf.h sys
/socketcall.h sigstack.h
335 .PHONY
: remove-old-headers
337 rm -f
$(addprefix $(inst_includedir
)/, $(headers2_0
))