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
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 ifneq ($(AUTOCONF
),no
)
35 ifeq ($(with-cvs
),yes
)
36 define autoconf-it-cvs
37 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: autoconf $(ACFLAGS) $<' $@
45 $(AUTOCONF
) $(ACFLAGS
) $< > $@.new
51 configure
: configure.in aclocal.m4
; $(autoconf-it
)
52 %/configure
: %/configure.in aclocal.m4
; $(autoconf-it
)
54 endif # $(AUTOCONF) = no
57 # We don't want to run anything here in parallel.
60 # These are the targets that are made by making them in each subdirectory.
61 +subdir_targets
:= subdir_lib objects objs others subdir_mostlyclean \
62 subdir_clean subdir_distclean subdir_realclean \
63 tests xtests subdir_lint.out \
65 subdir_echo-headers subdir_echo-distinfo \
68 $(addprefix install-
, no-libc.a bin lib data headers others
)
70 headers
:= limits.h values.h features.h gnu-versions.h bits
/libc-lock.h \
71 bits
/xopen_lim.h gnu
/libc-version.h
73 echo-headers
: subdir_echo-headers
75 # The headers are in the include directory.
77 vpath
%.h
$(subdir-dirs
)
80 install-others
= $(inst_includedir
)/gnu
/stubs.h
81 install-bin-script
= glibcbug
83 ifeq (yes
,$(build-shared
))
84 headers
+= gnu
/lib-names.h
89 ifeq ($(build-programs
),yes
)
90 others
: $(addprefix $(objpfx
),$(install-bin-script
))
93 # Install from subdirectories too.
94 install: subdir_install
96 # Explicit dependency so that `make install-headers' works
97 install-headers
: install-headers-nosubdir
99 # Make sure that the dynamic linker is installed before libc.
100 $(inst_slibdir
)/libc-
$(version
).so
: elf
/ldso_install
102 .PHONY
: elf
/ldso_install
104 $(MAKE
) -C
$(@D
) $(@F
)
106 # Create links for shared libraries using the `ldconfig' program if possible.
107 # Ignore the error if we cannot update /etc/ld.so.cache.
108 ifeq (no
,$(cross-compiling
))
109 ifeq (yes
,$(build-shared
))
110 install: install-symbolic-link
111 .PHONY
: install-symbolic-link
112 install-symbolic-link
: subdir_install
113 $(symbolic-link-prog
) $(symbolic-link-list
)
114 rm -f
$(symbolic-link-list
)
117 -test ! -x
$(common-objpfx
)elf
/ldconfig || LC_ALL
=C LANGUAGE
=C \
118 $(common-objpfx
)elf
/ldconfig
$(addprefix -r
,$(install_root
)) \
121 ifeq (/usr
,$(prefix))
122 ifeq (,$(install_root
))
123 CC
="$(CC)" $(PERL
) scripts
/test-installation.pl
$(common-objpfx
)
130 # Build subdirectory lib objects.
131 lib-noranlib
: subdir_lib
133 ifeq (yes
,$(build-shared
))
134 # Build the shared object from the PIC object library.
135 lib
: $(common-objpfx
)libc.so
139 # This is a handy script for running any dynamically linked program against
140 # the current libc build for testing.
141 $(common-objpfx
)testrun.sh
: $(common-objpfx
)config.make \
142 $(..
)Makeconfig
$(..
)Makefile
144 echo
"GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
145 echo
'exec $(run-program-prefix) $${1+"$$@"}'; \
149 postclean-generated
+= testrun.sh
151 others
: $(common-objpfx
)testrun.sh
153 # Makerules creates a file `stubs' in each subdirectory, which
154 # contains `#define __stub_FUNCTION' for each function defined in that
155 # directory which is a stub.
156 # Here we paste all of these together into <gnu/stubs.h>.
158 subdir-stubs
:= $(foreach dir,$(subdirs
),$(common-objpfx
)$(dir)/stubs
)
160 # Since stubs.h is never needed when building the library, we simplify the
161 # hairy installation process by producing it in place only as the last part
162 # of the top-level `make install'. It depends on subdir_install, which
163 # iterates over all the subdirs; subdir_install in each subdir depends on
164 # the subdir's stubs file. Having more direct dependencies would result in
165 # extra iterations over the list for subdirs and many recursive makes.
166 $(inst_includedir
)/gnu
/stubs.h
: subdir_install
167 $(make-target-directory
)
168 @
rm -f
$(objpfx
)stubs.h
169 (echo
'/* This file is automatically generated.';\
170 echo
' It defines a symbol `__stub_FUNCTION'\'' for each function';\
171 echo
' in the C library which is a stub, meaning it will fail';\
172 echo
' every time called, usually setting errno to ENOSYS. */';\
173 LC_ALL
=C
sort $(subdir-stubs
)) > $(objpfx
)stubs.h
174 if
test -r
$@
&& cmp
-s
$(objpfx
)stubs.h
$@
; \
175 then echo
'stubs.h unchanged'; \
176 else $(INSTALL_DATA
) $(objpfx
)stubs.h
$@
; fi
177 rm -f
$(objpfx
)stubs.h
179 # The `glibcbug' script contains the version number and it shall be rebuild
180 # whenever this changes or the `glibcbug.in' file.
181 $(objpfx
)glibcbug
: $(common-objpfx
)config.status glibcbug.in
182 cd
$(<D
) && CONFIG_FILES
=$(@F
) CONFIG_HEADERS
= $(SHELL
) $(<F
)
184 # This makes the Info or DVI file of the documentation from the Texinfo source.
185 .PHONY
: info dvi pdf html
187 $(MAKE
) $(PARALLELMFLAGS
) -C manual
$@
189 # This makes all the subdirectory targets.
191 # For each target, make it depend on DIR/target for each subdirectory DIR.
192 $(+subdir_targets
): %: $(addsuffix /%,$(subdirs
))
194 # Compute a list of all those targets.
195 all-subdirs-targets
:= $(foreach dir,$(subdirs
),\
196 $(addprefix $(dir)/,$(+subdir_targets
)))
198 # The action for each of those is to cd into the directory and make the
200 $(all-subdirs-targets
):
201 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
203 .PHONY
: $(+subdir_targets
) $(all-subdirs-targets
)
205 # Targets to clean things up to various degrees.
207 .PHONY
: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
210 # Subroutines of all cleaning targets.
211 parent-mostlyclean
: common-mostlyclean
# common-mostlyclean is in Makerules.
212 -rm -f
$(foreach o
,$(object-suffixes-for-libc
),\
213 $(common-objpfx
)$(patsubst %,$(libtype
$o),c
)) \
214 $(addprefix $(objpfx
),$(install-lib
))
215 parent-clean
: parent-mostlyclean common-clean
217 postclean
= $(addprefix $(common-objpfx
),$(postclean-generated
)) \
218 $(addprefix $(objpfx
),sysd-dirs sysd-rules
) \
219 $(addprefix $(objpfx
),sysd-sorted soversions.mk soversions.i
)
222 # This is done this way rather than having `subdir_clean' be a
223 # dependency of this target so that libc.a will be removed before the
224 # subdirectories are dealt with and so they won't try to remove object
225 # files from it when it's going to be removed anyway.
226 @
$(MAKE
) subdir_clean no_deps
=t
228 mostlyclean: parent-mostlyclean
229 @
$(MAKE
) subdir_mostlyclean no_deps
=t
233 @
$(MAKE
) subdir_testclean no_deps
=t
235 # The realclean target is just like distclean for the parent, but we want
236 # the subdirs to know the difference in case they care.
237 realclean distclean: parent-clean
238 # This is done this way rather than having `subdir_distclean' be a
239 # dependency of this target so that libc.a will be removed before the
240 # subdirectories are dealt with and so they won't try to remove object
241 # files from it when it's going to be removed anyway.
242 @
$(MAKE
) distclean-1 no_deps
=t distclean-1
=$@ avoid-generated
=yes \
243 sysdep-subdirs
="$(sysdep-subdirs)"
246 # Subroutine of distclean and realclean.
247 distclean-1
: subdir_
$(distclean-1
)
248 -rm -f
$(config-generated
)
249 -rm -f
$(addprefix $(objpfx
),config.status config.cache config.log
)
250 -rm -f
$(addprefix $(objpfx
),config.make config-name.h config.h
)
251 -rm -f
$(addprefix $(objpfx
),glibcbug
)
253 -rm -f
$(objpfx
)Makefile
255 -rm -f
$(sysdep-
$(distclean-1
))
258 echo_subdirs
:;@echo
'$(subdirs)'
260 .PHONY
: echo-distinfo parent_echo-distinfo
261 echo-distinfo
: parent_echo-distinfo subdir_echo-distinfo
262 parent_echo-distinfo
:
263 @echo
$(addprefix +header
+,$(headers
)) \
264 $(addprefix +nodist
+,$(generated
))
267 # Make the distribution tarfile.
269 distribute
:= README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
270 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.
[0-9] \
271 ChangeLog
.1[0-9] Makefile Makeconfig Makerules Rules \
272 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
273 configure.in aclocal.m4 config.h.in config.make.in \
274 config-name.in Makefile.in sysdep.h set-hooks.h \
275 libc-symbols.h version.h shlib-versions rpm
/Makefile \
276 rpm
/template rpm
/rpmrc glibcbug.in abi-tags stub-tag.h \
277 test-skeleton.c
include/des.h
include/libc-internal.h \
278 include/shlib-compat.h
include/pthread.h Versions.def \
279 cppflags-iterator.mk INTERFACE CONFORMANCE NAMESPACE \
281 $(addprefix scripts
/, \
282 rellns-sh config.sub config.guess \
283 mkinstalldirs move-if-change install-sh \
284 test-installation.pl gen-FAQ.pl versions.awk\
285 gen-sorted.awk abi-versions.awk \
286 firstversions.awk documented.sh
cpp)
288 distribute
:= $(strip $(distribute
))
289 generated
:= $(generated
) stubs.h
291 README
: README.template version.h
293 sed
-e
's/RELEASE/$(release)/' -e
's/VERSION/$(version)/' < $< > $@
294 # Make it unwritable so I won't change it by mistake.
296 ifeq ($(with-cvs
),yes
)
297 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Remade for $(release)-$(version)' $@
302 makeinfo --no-validate
--no-warn
--no-headers
$< -o
$@
305 INSTALL
: manual
/install.texi
; $(format-me
)
306 NOTES
: manual
/creature.texi
; $(format-me
)
307 manual
/dir-add.texi manual
/dir-add.
info: FORCE
308 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
309 FAQ
: scripts
/gen-FAQ.pl FAQ.in
310 $(PERL
) $^
> $@.new
&& rm -f
$@
&& mv
$@.new
$@
&& chmod a-w
$@
311 ifeq ($(with-cvs
),yes
)
312 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: $(PERL) $^' $@
316 rpm
/%: subdir_distinfo
317 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
319 iconvdata
/% localedata
/% po
/% manual
/%:
320 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
322 # This is a special goal for people making binary distributions. Normally
323 # everybody uses the DES based crypt library but for the distribution we
324 # need the only-MD5 based one as well.
325 md5-crypt
/libmd5crypt
:
326 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
328 # glibc 2.0 contains some header files which aren't used with glibc 2.1
330 # These rules should remove those headers
331 ifeq (,$(install_root
))
332 ifeq ($(old-glibc-headers
),yes
)
333 install: remove-old-headers
337 headers2_0
:= __math.h bytesex.h confname.h direntry.h elfclass.h \
338 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
339 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
340 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
341 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
342 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
343 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
344 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
345 syscall-list.h termbits.h timebits.h ustatbits.h \
346 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
347 xopen_lim.h gnu
/types.h sys
/ipc_buf.h \
348 sys
/kernel_termios.h sys
/msq_buf.h sys
/sem_buf.h \
349 sys
/shm_buf.h sys
/socketcall.h sigstack.h
351 .PHONY
: remove-old-headers
353 rm -f
$(addprefix $(inst_includedir
)/, $(headers2_0
))