source: vendor/glibc-tests/glibc/Makefile

Last change on this file was 2036, checked in by bird, 20 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 11.9 KB
Line 
1# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
2# This file is part of the GNU C Library.
3
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.
8
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.
13
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.
18
19#
20# Master Makefile for the GNU C library
21#
22ifneq (,)
23This makefile requires GNU Make.
24endif
25
26include Makeconfig
27
28
29# This is the default target; it makes everything except the tests.
30.PHONY: all
31all: lib others
32
33
34ifneq ($(AUTOCONF),no)
35
36ifeq ($(with-cvs),yes)
37define autoconf-it-cvs
38test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
39endef
40else
41autoconf-it-cvs =
42endif
43
44define autoconf-it
45@-rm -f $@.new
46$(AUTOCONF) $(ACFLAGS) $< > $@.new
47chmod a-w,a+x $@.new
48mv -f $@.new $@
49$(autoconf-it-cvs)
50endef
51
52configure: configure.in aclocal.m4; $(autoconf-it)
53%/configure: %/configure.in aclocal.m4; $(autoconf-it)
54
55endif # $(AUTOCONF) = no
56
57
58# We don't want to run anything here in parallel.
59.NOTPARALLEL:
60
61# These are the targets that are made by making them in each subdirectory.
62+subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
63 subdir_clean subdir_distclean subdir_realclean \
64 tests xtests subdir_lint.out \
65 subdir_update-abi subdir_check-abi \
66 subdir_echo-headers \
67 subdir_install \
68 subdir_objs subdir_stubs subdir_testclean \
69 $(addprefix install-, no-libc.a bin lib data headers others)
70
71
72headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
73 bits/xopen_lim.h gnu/libc-version.h
74
75echo-headers: subdir_echo-headers
76
77# The headers are in the include directory.
78subdir-dirs = include
79vpath %.h $(subdir-dirs)
80
81# What to install.
82install-others = $(inst_includedir)/gnu/stubs.h
83install-bin-script =
84
85ifeq (yes,$(build-shared))
86headers += gnu/lib-names.h
87endif
88
89include Makerules
90
91ifeq ($(build-programs),yes)
92others: $(addprefix $(objpfx),$(install-bin-script))
93endif
94
95# Install from subdirectories too.
96install: subdir_install
97
98# Explicit dependency so that `make install-headers' works
99install-headers: install-headers-nosubdir
100
101# Make sure that the dynamic linker is installed before libc.
102$(inst_slibdir)/libc-$(version).so: elf/ldso_install
103
104.PHONY: elf/ldso_install
105elf/ldso_install:
106 $(MAKE) -C $(@D) $(@F)
107
108# Create links for shared libraries using the `ldconfig' program if possible.
109# Ignore the error if we cannot update /etc/ld.so.cache.
110ifeq (no,$(cross-compiling))
111ifeq (yes,$(build-shared))
112install: install-symbolic-link
113.PHONY: install-symbolic-link
114install-symbolic-link: subdir_install
115 $(symbolic-link-prog) $(symbolic-link-list)
116 rm -f $(symbolic-link-list)
117
118install:
119 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
120 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
121 $(slibdir) $(libdir)
122ifneq (no,$(PERL))
123ifeq (/usr,$(prefix))
124ifeq (,$(install_root))
125 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
126endif
127endif
128endif
129endif
130endif
131
132# Build subdirectory lib objects.
133lib-noranlib: subdir_lib
134
135ifeq (yes,$(build-shared))
136# Build the shared object from the PIC object library.
137lib: $(common-objpfx)libc.so
138endif
139
140
141# This is a handy script for running any dynamically linked program against
142# the current libc build for testing.
143$(common-objpfx)testrun.sh: $(common-objpfx)config.make \
144 $(..)Makeconfig $(..)Makefile
145 (echo '#!/bin/sh'; \
146 echo "GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
147 echo 'exec $(run-program-prefix) $${1+"$$@"}'; \
148 ) > $@T
149 chmod a+x $@T
150 mv -f $@T $@
151postclean-generated += testrun.sh
152
153others: $(common-objpfx)testrun.sh
154
155
156# Makerules creates a file `stubs' in each subdirectory, which
157# contains `#define __stub_FUNCTION' for each function defined in that
158# directory which is a stub.
159# Here we paste all of these together into <gnu/stubs.h>.
160
161subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
162
163ifeq ($(biarch),no)
164installed-stubs = $(inst_includedir)/gnu/stubs.h
165else
166installed-stubs = $(inst_includedir)/gnu/stubs-$(biarch).h
167
168$(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
169 $(INSTALL_DATA) $< $@
170
171install-others-nosubdir: $(installed-stubs)
172endif
173
174
175# Since stubs.h is never needed when building the library, we simplify the
176# hairy installation process by producing it in place only as the last part
177# of the top-level `make install'. It depends on subdir_install, which
178# iterates over all the subdirs; subdir_install in each subdir depends on
179# the subdir's stubs file. Having more direct dependencies would result in
180# extra iterations over the list for subdirs and many recursive makes.
181$(installed-stubs): include/stubs-prologue.h subdir_install
182 $(make-target-directory)
183 @rm -f $(objpfx)stubs.h
184 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
185 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
186 then echo 'stubs.h unchanged'; \
187 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
188 rm -f $(objpfx)stubs.h
189
190
191# This makes the Info or DVI file of the documentation from the Texinfo source.
192.PHONY: info dvi pdf html
193info dvi pdf html:
194 $(MAKE) $(PARALLELMFLAGS) -C manual $@
195
196
197# This makes all the subdirectory targets.
198
199# For each target, make it depend on DIR/target for each subdirectory DIR.
200$(+subdir_targets): %: $(addsuffix /%,$(subdirs))
201
202# Compute a list of all those targets.
203all-subdirs-targets := $(foreach dir,$(subdirs),\
204 $(addprefix $(dir)/,$(+subdir_targets)))
205
206# The action for each of those is to cd into the directory and make the
207# target there.
208$(all-subdirs-targets):
209 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
210
211.PHONY: $(+subdir_targets) $(all-subdirs-targets)
212
213
214# Targets to clean things up to various degrees.
215
216.PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
217 tests-clean
218
219# Subroutines of all cleaning targets.
220parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
221 -rm -f $(foreach o,$(object-suffixes-for-libc),\
222 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
223 $(addprefix $(objpfx),$(install-lib))
224parent-clean: parent-mostlyclean common-clean
225
226postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
227 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
228 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
229
230clean: parent-clean
231# This is done this way rather than having `subdir_clean' be a
232# dependency of this target so that libc.a will be removed before the
233# subdirectories are dealt with and so they won't try to remove object
234# files from it when it's going to be removed anyway.
235 @$(MAKE) subdir_clean no_deps=t
236 -rm -f $(postclean)
237mostlyclean: parent-mostlyclean
238 @$(MAKE) subdir_mostlyclean no_deps=t
239 -rm -f $(postclean)
240
241tests-clean:
242 @$(MAKE) subdir_testclean no_deps=t
243
244tests: $(objpfx)c++-types-check.out
245ifneq ($(CXX),no)
246check-data := $(firstword $(wildcard \
247 $(foreach M,$(config-machine) $(base-machine),\
248 scripts/data/c++-types-$M-$(config-os).data)))
249ifneq (,$(check-data))
250$(objpfx)c++-types-check.out: $(check-data)
251 scripts/check-c++-types.sh $^ $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@
252else
253$(objpfx)c++-types-check.out:
254 @echo 'WARNING C++ tests not run; create a c++-types-XXX file'
255 @echo "not run" > $@
256endif
257endif
258
259# The realclean target is just like distclean for the parent, but we want
260# the subdirs to know the difference in case they care.
261realclean distclean: parent-clean
262# This is done this way rather than having `subdir_distclean' be a
263# dependency of this target so that libc.a will be removed before the
264# subdirectories are dealt with and so they won't try to remove object
265# files from it when it's going to be removed anyway.
266 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
267 sysdep-subdirs="$(sysdep-subdirs)"
268 -rm -f $(postclean)
269
270# Subroutine of distclean and realclean.
271distclean-1: subdir_$(distclean-1)
272 -rm -f $(config-generated)
273 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
274 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
275ifdef objdir
276 -rm -f $(objpfx)Makefile
277endif
278 -rm -f $(sysdep-$(distclean-1))
279
280
281# Make the distribution tarfile.
282.PHONY: dist tag-for-dist
283
284generated := $(generated) stubs.h
285
286README: README.template version.h
287 -rm -f $@
288 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
289# Make it unwritable so I won't change it by mistake.
290 chmod 444 $@
291ifeq ($(with-cvs),yes)
292 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
293endif
294
295files-for-dist := README FAQ INSTALL NOTES configure
296
297tag-of-stem = glibc-$(subst .,_,$*)
298
299# Add-ons in the main repository but distributed in their own tar files.
300dist-separate = libidn linuxthreads
301
302# Directories in each add-on.
303dist-separate-libidn = libidn
304dist-separate-linuxthreads = linuxthreads linuxthreads_db
305
306glibc-%.tar $(dist-separate:%=glibc-%-%.tar): $(files-for-dist) \
307 $(foreach D,$(dist-separate),\
308 $D/configure)
309 @rm -fr glibc-$*
310 $(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(add-ons)) \
311 -name configure`
312 cvs $(CVSOPTS) -Q export -d glibc-$* -r $(tag-of-stem) libc
313# Touch all the configure scripts going into the tarball since cvs export
314# might have delivered configure.in newer than configure.
315 find glibc-$* -name configure -print | xargs touch
316 $(dist-do-separate-dirs)
317 tar cf glibc-$*.tar glibc-$*
318 rm -fr glibc-$*
319define dist-do-separate-dirs
320$(foreach dir,$(dist-separate),
321 tar cf glibc-$(dir)-$*.tar -C glibc-$* $(dist-separate-$(dir))
322 rm -rf $(addprefix glibc-$*/,$(dist-separate-$(dir)))
323)
324endef
325
326# Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
327dist-version = $(version)
328
329dist: $(foreach Z,.bz2 .gz,glibc-$(dist-version).tar$Z \
330 $(foreach D,$(dist-separate),\
331 glibc-$D-$(dist-version).tar$Z))
332 md5sum $^
333
334tag-for-dist: tag-$(dist-version)
335tag-%: $(files-for-dist)
336 cvs $(CVSOPTS) -Q tag -c $(tag-of-stem)
337
338define format-me
339@rm -f $@
340makeinfo --no-validate --no-warn --no-headers $< -o $@
341-chmod a-w $@
342endef
343INSTALL: manual/install.texi; $(format-me)
344NOTES: manual/creature.texi; $(format-me)
345manual/dir-add.texi manual/dir-add.info: FORCE
346 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
347FAQ: scripts/gen-FAQ.pl FAQ.in
348 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
349ifeq ($(with-cvs),yes)
350 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
351endif
352FORCE:
353
354iconvdata/% localedata/% po/% manual/%:
355 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
356
357# glibc 2.0 contains some header files which aren't used with glibc 2.1
358# anymore.
359# These rules should remove those headers
360ifeq (,$(install_root))
361ifeq ($(old-glibc-headers),yes)
362install: remove-old-headers
363endif
364endif
365
366headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
367 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
368 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
369 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
370 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
371 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
372 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
373 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
374 syscall-list.h termbits.h timebits.h ustatbits.h \
375 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
376 xopen_lim.h gnu/types.h sys/ipc_buf.h \
377 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
378 sys/shm_buf.h sys/socketcall.h sigstack.h
379
380.PHONY: remove-old-headers
381remove-old-headers:
382 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))
Note: See TracBrowser for help on using the repository browser.