1 # Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 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 configure
: configure.in aclocal.m4
; $(autoconf-it
)
51 %/configure
: %/configure.in aclocal.m4
; $(autoconf-it
)
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 subdir_lint.out \
58 subdir_echo-headers subdir_echo-distinfo \
60 $(addprefix install-
, no-libc.a bin lib data headers others
)
62 headers
:= errno.h sys
/errno.h bits
/errno.h limits.h values.h \
63 features.h gnu-versions.h bits
/libc-lock.h bits
/xopen_lim.h \
66 echo-headers
: subdir_echo-headers
68 # The headers are in the include directory.
70 vpath
%.h
$(subdir-dirs
)
73 install-others
= $(inst_includedir
)/gnu
/stubs.h
74 install-bin
= glibcbug
76 ifeq (yes
,$(build-shared
))
77 install-others
+= $(inst_includedir
)/gnu
/lib-names.h
82 ifeq ($(build-programs
),yes
)
83 others
: $(addprefix $(objpfx
),$(install-bin
))
86 # Install from subdirectories too.
87 install: subdir_install
89 # Create links for shared libraries using the `ldconfig' program is possible.
90 # Ignore the error if we cannot update /etc/ld.so.cache.
91 ifeq (no
,$(cross-compiling
))
92 ifeq (yes
,$(build-shared
))
93 install: install-symbolic-link
94 .PHONY
: install-symbolic-link
95 install-symbolic-link
: subdir_install
96 $(symbolic-link-prog
) $(symbolic-link-list
)
99 -test ! -x
$(common-objpfx
)elf
/ldconfig || \
100 $(common-objpfx
)elf
/ldconfig
-d
$(inst_slibdir
) $(inst_libdir
)
102 ifeq (/usr
,$(prefix))
103 ifeq (,$(install_root
))
104 CC
="$(CC)" $(PERL
) scripts
/test-installation.pl
$(common-objpfx
)
111 # Build subdirectory lib objects.
112 lib-noranlib
: subdir_lib
114 ifeq (yes
,$(build-shared
))
115 # Build the shared object from the PIC object library.
116 lib
: $(common-objpfx
)libc.so
119 # Makerules creates a file `stubs' in each subdirectory, which
120 # contains `#define __stub_FUNCTION' for each function defined in that
121 # directory which is a stub.
122 # Here we paste all of these together into <gnu/stubs.h>.
124 subdir-stubs
:= $(foreach dir,$(subdirs
),$(common-objpfx
)$(dir)/stubs
)
126 # Since stubs.h is never needed when building the library, we simplify the
127 # hairy installation process by producing it in place only as the last part
128 # of the top-level `make install'. It depends on subdir_install, which
129 # iterates over all the subdirs; subdir_install in each subdir depends on
130 # the subdir's stubs file. Having more direct dependencies would result in
131 # extra iterations over the list for subdirs and many recursive makes.
132 $(inst_includedir
)/gnu
/stubs.h
: subdir_install
133 $(make-target-directory
)
134 @
rm -f
$(objpfx
)stubs.h
135 (echo
'/* This file is automatically generated.';\
136 echo
' It defines a symbol `__stub_FUNCTION'\'' for each function';\
137 echo
' in the C library which is a stub, meaning it will fail';\
138 echo
' every time called, usually setting errno to ENOSYS. */';\
139 sort $(subdir-stubs
)) > $(objpfx
)stubs.h
140 if
test -r
$@
&& cmp
-s
$(objpfx
)stubs.h
$@
; \
141 then echo
'stubs.h unchanged'; \
142 else $(INSTALL_DATA
) $(objpfx
)stubs.h
$@
; fi
143 rm -f
$(objpfx
)stubs.h
145 ifeq (yes
,$(build-shared
))
147 $(inst_includedir
)/gnu
/lib-names.h
: $(common-objpfx
)gnu
/lib-names.h
$(+force)
148 $(make-target-directory
)
149 if
test -r
$@
&& cmp
-s
$< $@
; \
150 then echo
'gnu/lib-names.h unchanged'; \
151 else $(INSTALL_DATA
) $< $@
; fi
154 # The `glibcbug' script contains the version number and it shall be rebuild
155 # whenever this changes or the `glibcbug.in' file.
156 $(objpfx
)glibcbug
: $(common-objpfx
)config.status glibcbug.in
157 cd
$(<D
) && CONFIG_FILES
=$(@F
) CONFIG_HEADERS
= $(SHELL
) $(<F
)
159 # This makes the Info or DVI file of the documentation from the Texinfo source.
162 $(MAKE
) $(PARALLELMFLAGS
) -C manual
$@
164 # This makes all the subdirectory targets.
166 # For each target, make it depend on DIR/target for each subdirectory DIR.
167 $(+subdir_targets
): %: $(addsuffix /%,$(subdirs
))
169 # Compute a list of all those targets.
170 all-subdirs-targets
:= $(foreach dir,$(subdirs
),\
171 $(addprefix $(dir)/,$(+subdir_targets
)))
173 # The action for each of those is to cd into the directory and make the
175 $(all-subdirs-targets
):
176 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
178 .PHONY
: $(+subdir_targets
) $(all-subdirs-targets
)
180 # Targets to clean things up to various degrees.
182 .PHONY
: clean realclean distclean distclean-1 parent-clean parent-mostlyclean
184 # Subroutines of all cleaning targets.
185 parent-mostlyclean
: common-mostlyclean
# common-mostlyclean is in Makerules.
186 -rm -f
$(foreach o
,$(object-suffixes-for-libc
),\
187 $(common-objpfx
)$(patsubst %,$(libtype
$o),c
)) \
188 $(addprefix $(objpfx
),$(install-lib
))
189 parent-clean
: parent-mostlyclean common-clean
191 postclean
= $(addprefix $(common-objpfx
),$(postclean-generated
)) \
192 $(addprefix $(objpfx
),sysd-Makefile sysd-dirs sysd-rules
) \
193 $(objpfx
)soversions.mk
196 # This is done this way rather than having `subdir_clean' be a
197 # dependency of this target so that libc.a will be removed before the
198 # subdirectories are dealt with and so they won't try to remove object
199 # files from it when it's going to be removed anyway.
200 @
$(MAKE
) subdir_clean no_deps
=t
201 mostlyclean: parent-mostlyclean
202 @
$(MAKE
) subdir_mostlyclean no_deps
=t
205 # The realclean target is just like distclean for the parent, but we want
206 # the subdirs to know the difference in case they care.
207 realclean distclean: parent-clean
208 # This is done this way rather than having `subdir_distclean' be a
209 # dependency of this target so that libc.a will be removed before the
210 # subdirectories are dealt with and so they won't try to remove object
211 # files from it when it's going to be removed anyway.
212 @
$(MAKE
) distclean-1 no_deps
=t distclean-1
=$@ avoid-generated
=yes \
213 sysdep-subdirs
="$(sysdep-subdirs)"
216 # Subroutine of distclean and realclean.
217 distclean-1
: subdir_
$(distclean-1
)
218 -rm -f
$(config-generated
)
219 -rm -f
$(addprefix $(objpfx
),config.status config.cache config.log
)
220 -rm -f
$(addprefix $(objpfx
),config.make config-name.h config.h
)
221 -rm -f
$(addprefix $(objpfx
),glibcbug
)
223 -rm -f
$(objpfx
)Makefile
225 -rm -f
$(sysdep-
$(distclean-1
))
228 echo_subdirs
:;@echo
'$(subdirs)'
230 .PHONY
: echo-distinfo parent_echo-distinfo
231 echo-distinfo
: parent_echo-distinfo subdir_echo-distinfo
232 parent_echo-distinfo
:
233 @echo
$(addprefix +header
+,$(headers
)) \
234 $(addprefix +nodist
+,$(generated
))
237 # Make the distribution tarfile.
239 distribute
:= README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
240 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.
[0-9] \
241 Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
242 extra-lib.mk o-iterator.mk configure configure.in \
243 aclocal.m4 config.h.in config.make.in config-name.in \
244 Makefile.in sysdep.h set-hooks.h libc-symbols.h \
245 version.h shlib-versions rpm
/Makefile rpm
/template \
246 rpm
/rpmrc glibcbug.in abi-tags stub-tag.h \
247 test-skeleton.c
include/des.h Versions.def \
248 $(addprefix scripts
/, \
249 rellns-sh config.sub config.guess \
250 mkinstalldirs move-if-change install-sh \
251 test-installation.pl gen-FAQ.pl versions.awk
)
253 distribute
:= $(strip $(distribute
))
254 generated
:= $(generated
) stubs.h
256 README
: README.template version.h
; # Make-dist should update README.
260 makeinfo --no-validate
--no-warn
--no-headers
$< -o
$@
263 INSTALL
: manual
/install.texi
; $(format-me
)
264 NOTES
: manual
/creature.texi
; $(format-me
)
265 manual
/dir-add.texi manual
/dir-add.
info: FORCE
266 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
267 FAQ
: scripts
/gen-FAQ.pl FAQ.in
268 $(PERL
) $^
> $@.new
&& rm -f
$@
&& mv
$@.new
$@
&& chmod a-w
$@
269 ifeq ($(with-cvs
),yes
)
270 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: $(PERL) $^' $@
274 rpm
/%: subdir_distinfo
275 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
278 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
280 # This is a special goal for people making binary distributions. Normally
281 # everybody uses the DES based crypt library but for the distribution we
282 # need the only-MD5 based one as well.
283 md5-crypt
/libmd5crypt
:
284 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
286 # glibc 2.0 contains some header files which aren't used with glibc 2.1
288 # These rules should remove those headers
289 ifeq (,$(install_root
))
290 ifeq ($(old-glibc-headers
),yes
)
291 install: remove-old-headers
295 headers2_0
:= __math.h bytesex.h confname.h direntry.h elfclass.h \
296 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
297 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
298 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
299 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
300 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
301 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
302 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
303 syscall-list.h termbits.h timebits.h ustatbits.h \
304 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
305 xopen_lim.h gnu
/types.h sys
/ipc_buf.h \
306 sys
/kernel_termios.h sys
/msq_buf.h sys
/sem_buf.h \
307 sys
/shm_buf.h sys
/socketcall.h sigstack.h
309 .PHONY
: remove-old-headers
311 rm -f
$(addprefix $(inst_includedir
)/, $(headers2_0
))