]> git.ipfire.org Git - thirdparty/glibc.git/blame - Make-dist
(gnulib): If have-cc-withh-libunwind is "yes", also mention -lunwind.
[thirdparty/glibc.git] / Make-dist
CommitLineData
643931fb 1# Copyright (C) 1991-2001, 2002, 2003 Free Software Foundation, Inc.
28f540f4
RM
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
41bdb6e2
AJ
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.
28f540f4
RM
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
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2
AJ
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.
28f540f4
RM
18
19dist:
20
61ee476c
RM
21# Make the value empty so ifdef fails if it's $(-subdir).
22subdir := $(subdir)
28f540f4
RM
23ifdef subdir
24.. := ../
25else
26.. :=
27endif
28
29include $(..)Makeconfig
30
31foo:=$(shell echo 'distribute=$(distribute)'>&2)
1f64ac13 32foo:=$(shell echo 'dont_distribute=$(dont_distribute)'>&2)
28f540f4
RM
33foo:=$(shell echo 'foobar=$(filter %.c %.S %.s %.h,$(distribute))'>&2)
34
35ifndef sysdep_dirs
36# Find all sysdep directories.
b9b49b44 37export sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name bits \
abe71ca6
UD
38 ! -name CVS ! -name RCS \
39 ! -name SCCS -print)
28f540f4
RM
40else
41# Defined by the parent.
42sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
43endif
44
569c558c
UD
45# Don't distribute add-on subdirs.
46subdirs := $(filter-out $(add-ons),$(subdirs))
47
8f2ece69
UD
48# Make sure both aout and elf get in, whichever is in use.
49subdirs += aout elf
50
28f540f4
RM
51sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
52ifdef sysdep-Subdir-files
53subdirs := $(sort $(subdirs) \
54 $(shell sed -e 's/\#.*$$//' $(sysdep-Subdir-files)))
55endif
56
57
58# Makefiles can define `source_dirs' to list nonstandard directories
59# where source files might be found.
60
61ifdef subdir
dfe1754a 62all-headers = $(filter-out $(sysdep_headers),$(headers))
28f540f4
RM
63else
64+distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
65 inhibit_interface_rules=t inhibit_mach_syscalls=t \
643931fb 66 inhibit_timezone_rules=t generating=t \
28f540f4
RM
67 subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
68foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
69all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
70# Ignore subdir headers without top-level indirections.
762a2918
UD
71all-headers := $(sort $(headers) \
72 $(patsubst include/%,%,\
73 $(wildcard $(addprefix include/,\
74 $(all-headers)))))
75# Filter out names like ../conf/portability.h that would point outside
76# the source directory.
77all-headers := $(filter-out ../%,$(all-headers))
28f540f4 78+subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
28f540f4
RM
79endif
80foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
81
92f3773b
RM
82sources += $(addsuffix .c,$(elided-routines) \
83 $(foreach l,$(extra-libs),$($l-routines)))
84
4c53d221
UD
85sources += $(addsuffix .c, $(filter-out $(elided-routines), \
86 $(tests) $(xtests)))
002ab034 87
28f540f4
RM
88# Find all sysdep sources and headers.
89+maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
90 $(filter %.c %.S %.s %.h %.sub,$(distribute))
91foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
dd7d45e8 92# Find all the files that have a generic version.
b3ed8219
AS
93generic-dirs = $(..)sysdeps/generic $(..)sysdeps/ieee754 \
94 $(..)sysdeps/ieee754/flt-32 $(..)sysdeps/ieee754/dbl-64 \
95 $(..)sysdeps/ieee754/ldbl-96 $(..)sysdeps/ieee754/ldbl-128
96try-sysdeps := $(foreach dir,$(generic-dirs),\
28f540f4
RM
97 $(addprefix $(dir)/,$(+maybe-sysdeps)))
98foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
99+sysdeps := $(wildcard $(try-sysdeps))
dd7d45e8 100foo:=$(shell echo 'generic +sysdeps=$(+sysdeps)'>&2)
b3ed8219
AS
101+sysdep-names := $(sort $(foreach dir, $(generic-dirs),\
102 $(patsubst $(dir)/%,%,\
103 $(filter $(dir)/%,$(+sysdeps)))))
28f540f4
RM
104foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
105
aa592a63 106ifdef subdir-dirs
dfe1754a 107vpath % $(subdir-dirs)
aa592a63
RM
108endif
109
28f540f4 110# Now find all the sysdep versions of those files.
e50ec9f9
RM
111+sysdeps := $(foreach dir,$(sysdep_dirs) $(source_dirs),\
112 $(wildcard $(addprefix $(dir)/, \
28f540f4
RM
113 $(+sysdep-names) \
114 $(+sysdep-names:.c=.s) \
115 $(+sysdep-names:.c=.S) \
116 )))
117
118
119# Source and header files to go in the distribution tar file.
120
121.S.s := $(wildcard $(sources:.c=.S) $(sources:.c=.s))
122sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
123
124+out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
125 $(addsuffix .c,$(sysdep_routines)) \
1f64ac13
UD
126 $(+subdir-nodist) $(dont_distribute)
127foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
51bba858 128+tsrcs := $(filter-out $(+out), $(sources) $(all-headers)) $(+sysdeps)
8882a2da 129foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
28f540f4 130foo:=$(shell echo generated='$(generated)' >&2)
b4012b75
UD
131#generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
132#foo:=$(shell echo now generated='$(generated)' >&2)
51bba858
UD
133+tsrcs := $(filter-out $(generated),$(+tsrcs))
134+tsrcs := $(sort $(filter-out $(+out),$(+tsrcs) $(distribute)))
28f540f4
RM
135foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
136foo:=$(shell echo foobie, dammit! >&2)
137
138ifndef tardir
28f540f4
RM
139export tardir := glibc-$(version)
140endif
141
142$(..)glibc-$(version):
143 ln -s . $@
144
569c558c
UD
145#+tsrcs := $(+tsrcs) \
146# TAGS
28f540f4
RM
147.PHONY: TAGS
148TAGS: $(..)MakeTAGS
149 $(MAKE) -f $< $@ -o subdir_TAGS
150
151ifdef subdir
152
153foo:=$(shell echo subdir foo >&2)
154
bb41a976 155+tsrcs := Makefile $(wildcard Versions) $(wildcard Depend) $(+tsrcs) \
002ab034 156 $(addsuffix .c,$(others) $(test-srcs)) \
4c53d221 157 $(wildcard $(addsuffix .input,$(tests) $(xtests) $(test-srcs)))
28f540f4 158+tardeps := $(strip $(+tsrcs))
28f540f4
RM
159
160verbose = v
161
162.PHONY: dist
163dist: $(..)$(tardir) $(+tardeps)
164 @cd ..; if test -f dist.tar; then c=u; else c=c; fi; \
165 $(+cmdecho) "cd ..; tar $${c}h$(verbose)f dist.tar ..."; \
f127cd28 166 tar $${c}h$(verbose)f dist.tar \
db54bbfb
AJ
167 $(addprefix $(tardir)/$(subdir)/,$(filter-out $< ../%,$^)) \
168 $(addprefix $(tardir)/,\
169 $(patsubst ../%,%,$(filter-out $<,$(filter ../%,$^))))
28f540f4
RM
170
171else # Parent makefile.
172
173# Find what other things sysdep directories want to distribute.
174
175foo:=$(shell echo parent foobie>&2)
176+sysdep-distfiles := $(wildcard $(addsuffix /Dist,$(sysdep_dirs)))
177foo:=$(shell echo +sysdep-distfiles='$(+sysdep-distfiles)'>&2)
178+sysdep-dist := $(foreach file,$(+sysdep-distfiles),\
179 $(addprefix $(dir $(file)), \
180 $(shell sed -e 's/\#.*$$//' $(file)))) \
181 $(+sysdep-distfiles) \
182 $(sysdep-Subdir-files)
183foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
184
083973f3 185+sysdep-tsrcs := $(wildcard $(foreach file,Makefile Makeconfig Implies \
fc71a2d4 186 configure configure.in Versions\
083973f3 187 syscalls.list libm-test-ulps,\
28f540f4
RM
188 $(addsuffix /$(file),$(sysdep_dirs)))) \
189 $(+sysdep-dist)
190
9c4c0024 191+tsrcs := $(+tsrcs) $(+sysdep-tsrcs) $(wildcard $(+sysdep-names:%=include/%))
28f540f4 192
1400de2e
RM
193ifneq ($(AUTOCONF),no)
194
880f421f 195ifeq ($(with-cvs),yes)
1400de2e 196define autoconf-it-cvs
379bb425 197test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
28f540f4 198endef
880f421f 199else
1400de2e
RM
200autoconf-it-cvs =
201endif
202
880f421f 203define autoconf-it
1400de2e
RM
204@-rm -f $@.new
205$(AUTOCONF) $(ACFLAGS) $< > $@.new
206chmod a-w,a+x $@.new
880f421f 207mv -f $@.new $@
1400de2e 208$(autoconf-it-cvs)
880f421f 209endef
28f540f4 210
dbdb6189
RM
211configure: configure.in aclocal.m4; $(autoconf-it)
212%/configure: %/configure.in aclocal.m4; $(autoconf-it)
28f540f4 213
1400de2e
RM
214endif # $(AUTOCONF) = no
215
216
4c53d221 217dist: $(tardir).tar.bz2
44f8b0fd 218 rm $(tardir).tar
28f540f4
RM
219
220subdir_dist: dist.tar
2303f5fd 221dist.tar: README $(tardir) $(+tsrcs)
28f540f4
RM
222 tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
223
224$(tardir).tar: dist.tar subdir_dist
d0883b48 225 tar xf $< -C $${TMPDIR-/tmp}
779ae82e
UD
226 tar covf $@ -C $${TMPDIR-/tmp} $(tardir)
227 -rm -fr $${TMPDIR-/tmp}/$(tardir) dist.tar &
44f8b0fd 228 rm $(tardir)
28f540f4
RM
229
230%.Z: %
231 compress -c $< > $@
232
233%.gz: %
234 gzip -9 -v -c $< > $@
235
4c53d221
UD
236%.bz2: %
237 bzip2 -9 -v -c $< > $@
238
28f540f4
RM
239foo:=$(shell echo subdirs=$(subdirs) >&2)
240dist-subdirs := $(addprefix dist-,$(subdirs)) # dist-manual
241.PHONY: subdir_dist $(dist-subdirs)
242subdir_dist: $(dist-subdirs)
243$(dist-subdirs):
244 $(MAKE) -C $(patsubst dist-%,%,$@) dist
245
246# This is here instead of in Makefile so it can use $(release) and $(version).
8d57beea 247README: README.template version.h
28f540f4
RM
248 -rm -f $@
249 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
250# Make it unwritable so I won't change it by mistake.
251 chmod 444 $@
880f421f 252ifeq ($(with-cvs),yes)
379bb425 253 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
880f421f 254endif
28f540f4
RM
255
256
257endif # Subdirectory vs. parent makefile
258\f
259# Get these things out of the environment because they take up lots of space.
260unexport distribute generated
261
262# Fnord.
263export inhibit_mach_syscalls=t
264export no_deps=t
265export inhibit_interface_rules=t
643931fb 266export generating=t