]> sourceware.org Git - glibc.git/blame - Make-dist
Update.
[glibc.git] / Make-dist
CommitLineData
fc71a2d4 1# Copyright (C) 1991-1999, 2000 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
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.
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# Library General Public License for more details.
13
14# You should have received a copy of the GNU Library General Public
0c5ecdc4
UD
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.
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
9f447fb3
RM
48# Make sure both stdio and libio get in, whichever is in use.
49subdirs += stdio libio
50
8f2ece69
UD
51# Make sure both aout and elf get in, whichever is in use.
52subdirs += aout elf
53
28f540f4
RM
54sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
55ifdef sysdep-Subdir-files
56subdirs := $(sort $(subdirs) \
57 $(shell sed -e 's/\#.*$$//' $(sysdep-Subdir-files)))
58endif
59
60
61# Makefiles can define `source_dirs' to list nonstandard directories
62# where source files might be found.
63
64ifdef subdir
dfe1754a 65all-headers = $(filter-out $(sysdep_headers),$(headers))
28f540f4
RM
66else
67+distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
68 inhibit_interface_rules=t inhibit_mach_syscalls=t \
4260bc74 69 inhibit_timezone_rules=t \
28f540f4
RM
70 subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
71foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
72all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
73# Ignore subdir headers without top-level indirections.
762a2918
UD
74all-headers := $(sort $(headers) \
75 $(patsubst include/%,%,\
76 $(wildcard $(addprefix include/,\
77 $(all-headers)))))
78# Filter out names like ../conf/portability.h that would point outside
79# the source directory.
80all-headers := $(filter-out ../%,$(all-headers))
28f540f4 81+subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
28f540f4
RM
82endif
83foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
84
92f3773b
RM
85sources += $(addsuffix .c,$(elided-routines) \
86 $(foreach l,$(extra-libs),$($l-routines)))
87
002ab034
UD
88sources += $(addsuffix .c, $(filter-out $(elided-routines), $(tests)))
89
28f540f4
RM
90# Find all sysdep sources and headers.
91+maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
92 $(filter %.c %.S %.s %.h %.sub,$(distribute))
93foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
dd7d45e8 94# Find all the files that have a generic version.
b3ed8219
AS
95generic-dirs = $(..)sysdeps/generic $(..)sysdeps/ieee754 \
96 $(..)sysdeps/ieee754/flt-32 $(..)sysdeps/ieee754/dbl-64 \
97 $(..)sysdeps/ieee754/ldbl-96 $(..)sysdeps/ieee754/ldbl-128
98try-sysdeps := $(foreach dir,$(generic-dirs),\
28f540f4
RM
99 $(addprefix $(dir)/,$(+maybe-sysdeps)))
100foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
101+sysdeps := $(wildcard $(try-sysdeps))
dd7d45e8 102foo:=$(shell echo 'generic +sysdeps=$(+sysdeps)'>&2)
b3ed8219
AS
103+sysdep-names := $(sort $(foreach dir, $(generic-dirs),\
104 $(patsubst $(dir)/%,%,\
105 $(filter $(dir)/%,$(+sysdeps)))))
28f540f4
RM
106foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
107
aa592a63 108ifdef subdir-dirs
dfe1754a 109vpath % $(subdir-dirs)
aa592a63
RM
110endif
111
28f540f4 112# Now find all the sysdep versions of those files.
e50ec9f9
RM
113+sysdeps := $(foreach dir,$(sysdep_dirs) $(source_dirs),\
114 $(wildcard $(addprefix $(dir)/, \
28f540f4
RM
115 $(+sysdep-names) \
116 $(+sysdep-names:.c=.s) \
117 $(+sysdep-names:.c=.S) \
118 )))
119
120
121# Source and header files to go in the distribution tar file.
122
123.S.s := $(wildcard $(sources:.c=.S) $(sources:.c=.s))
124sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
125
126+out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
127 $(addsuffix .c,$(sysdep_routines)) \
1f64ac13
UD
128 $(+subdir-nodist) $(dont_distribute)
129foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
51bba858 130+tsrcs := $(filter-out $(+out), $(sources) $(all-headers)) $(+sysdeps)
8882a2da 131foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
28f540f4 132foo:=$(shell echo generated='$(generated)' >&2)
b4012b75
UD
133#generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
134#foo:=$(shell echo now generated='$(generated)' >&2)
51bba858
UD
135+tsrcs := $(filter-out $(generated),$(+tsrcs))
136+tsrcs := $(sort $(filter-out $(+out),$(+tsrcs) $(distribute)))
28f540f4
RM
137foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
138foo:=$(shell echo foobie, dammit! >&2)
139
140ifndef tardir
28f540f4
RM
141export tardir := glibc-$(version)
142endif
143
144$(..)glibc-$(version):
145 ln -s . $@
146
569c558c
UD
147#+tsrcs := $(+tsrcs) \
148# TAGS
28f540f4
RM
149.PHONY: TAGS
150TAGS: $(..)MakeTAGS
151 $(MAKE) -f $< $@ -o subdir_TAGS
152
153ifdef subdir
154
155foo:=$(shell echo subdir foo >&2)
156
bb41a976 157+tsrcs := Makefile $(wildcard Versions) $(wildcard Depend) $(+tsrcs) \
002ab034 158 $(addsuffix .c,$(others) $(test-srcs)) \
490dc9aa 159 $(wildcard $(addsuffix .input,$(tests) $(test-srcs)))
28f540f4 160+tardeps := $(strip $(+tsrcs))
28f540f4
RM
161
162verbose = v
163
164.PHONY: dist
165dist: $(..)$(tardir) $(+tardeps)
166 @cd ..; if test -f dist.tar; then c=u; else c=c; fi; \
167 $(+cmdecho) "cd ..; tar $${c}h$(verbose)f dist.tar ..."; \
f127cd28 168 tar $${c}h$(verbose)f dist.tar \
db54bbfb
AJ
169 $(addprefix $(tardir)/$(subdir)/,$(filter-out $< ../%,$^)) \
170 $(addprefix $(tardir)/,\
171 $(patsubst ../%,%,$(filter-out $<,$(filter ../%,$^))))
28f540f4
RM
172
173else # Parent makefile.
174
175# Find what other things sysdep directories want to distribute.
176
177foo:=$(shell echo parent foobie>&2)
178+sysdep-distfiles := $(wildcard $(addsuffix /Dist,$(sysdep_dirs)))
179foo:=$(shell echo +sysdep-distfiles='$(+sysdep-distfiles)'>&2)
180+sysdep-dist := $(foreach file,$(+sysdep-distfiles),\
181 $(addprefix $(dir $(file)), \
182 $(shell sed -e 's/\#.*$$//' $(file)))) \
183 $(+sysdep-distfiles) \
184 $(sysdep-Subdir-files)
185foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
186
9f447fb3 187+sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies syscalls.list\
fc71a2d4
UD
188 configure configure.in Versions\
189 libm-test-ulps,\
28f540f4
RM
190 $(addsuffix /$(file),$(sysdep_dirs)))) \
191 $(+sysdep-dist)
192
9c4c0024 193+tsrcs := $(+tsrcs) $(+sysdep-tsrcs) $(wildcard $(+sysdep-names:%=include/%))
28f540f4 194
880f421f 195ifeq ($(with-cvs),yes)
28f540f4
RM
196define autoconf-it
197autoconf $(ACFLAGS) $< > $@.new
198mv -f $@.new $@
379bb425 199test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
28f540f4 200endef
880f421f
UD
201else
202define autoconf-it
203autoconf $(ACFLAGS) $< > $@.new
204mv -f $@.new $@
205endef
206endif
28f540f4 207
dbdb6189
RM
208configure: configure.in aclocal.m4; $(autoconf-it)
209%/configure: %/configure.in aclocal.m4; $(autoconf-it)
28f540f4 210
5325738c 211dist: $(tardir).tar.gz
28f540f4
RM
212
213subdir_dist: dist.tar
2303f5fd 214dist.tar: README $(tardir) $(+tsrcs)
28f540f4
RM
215 tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
216
217$(tardir).tar: dist.tar subdir_dist
9dd2fc5d 218 @echo Files listed here have names exceeding 14 chars.
779ae82e
UD
219 tar xfv $< -C $${TMPDIR-/tmp} | sed -n '/[^/]\{15,\}/p'
220 tar covf $@ -C $${TMPDIR-/tmp} $(tardir)
221 -rm -fr $${TMPDIR-/tmp}/$(tardir) dist.tar &
28f540f4
RM
222
223%.Z: %
224 compress -c $< > $@
225
226%.gz: %
227 gzip -9 -v -c $< > $@
228
229foo:=$(shell echo subdirs=$(subdirs) >&2)
230dist-subdirs := $(addprefix dist-,$(subdirs)) # dist-manual
231.PHONY: subdir_dist $(dist-subdirs)
232subdir_dist: $(dist-subdirs)
233$(dist-subdirs):
234 $(MAKE) -C $(patsubst dist-%,%,$@) dist
235
236# This is here instead of in Makefile so it can use $(release) and $(version).
8d57beea 237README: README.template version.h
28f540f4
RM
238 -rm -f $@
239 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
240# Make it unwritable so I won't change it by mistake.
241 chmod 444 $@
880f421f 242ifeq ($(with-cvs),yes)
379bb425 243 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
880f421f 244endif
28f540f4
RM
245
246
247endif # Subdirectory vs. parent makefile
248\f
249# Get these things out of the environment because they take up lots of space.
250unexport distribute generated
251
252# Fnord.
253export inhibit_mach_syscalls=t
254export no_deps=t
255export inhibit_interface_rules=t
This page took 0.141092 seconds and 5 git commands to generate.