]> sourceware.org Git - glibc.git/blob - Make-dist
Pretty print.
[glibc.git] / Make-dist
1 # Copyright (C) 1991-1999, 2000 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 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
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.
18
19 dist:
20
21 # Make the value empty so ifdef fails if it's $(-subdir).
22 subdir := $(subdir)
23 ifdef subdir
24 .. := ../
25 else
26 .. :=
27 endif
28
29 include $(..)Makeconfig
30
31 foo:=$(shell echo 'distribute=$(distribute)'>&2)
32 foo:=$(shell echo 'dont_distribute=$(dont_distribute)'>&2)
33 foo:=$(shell echo 'foobar=$(filter %.c %.S %.s %.h,$(distribute))'>&2)
34
35 ifndef sysdep_dirs
36 # Find all sysdep directories.
37 export sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name bits \
38 ! -name CVS ! -name RCS \
39 ! -name SCCS -print)
40 else
41 # Defined by the parent.
42 sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
43 endif
44
45 # Don't distribute add-on subdirs.
46 subdirs := $(filter-out $(add-ons),$(subdirs))
47
48 # Make sure both stdio and libio get in, whichever is in use.
49 subdirs += stdio libio
50
51 # Make sure both aout and elf get in, whichever is in use.
52 subdirs += aout elf
53
54 sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
55 ifdef sysdep-Subdir-files
56 subdirs := $(sort $(subdirs) \
57 $(shell sed -e 's/\#.*$$//' $(sysdep-Subdir-files)))
58 endif
59
60
61 # Makefiles can define `source_dirs' to list nonstandard directories
62 # where source files might be found.
63
64 ifdef subdir
65 all-headers = $(filter-out $(sysdep_headers),$(headers))
66 else
67 +distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
68 inhibit_interface_rules=t inhibit_mach_syscalls=t \
69 inhibit_timezone_rules=t \
70 subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
71 foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
72 all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
73 # Ignore subdir headers without top-level indirections.
74 all-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.
80 all-headers := $(filter-out ../%,$(all-headers))
81 +subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
82 endif
83 foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
84
85 sources += $(addsuffix .c,$(elided-routines) \
86 $(foreach l,$(extra-libs),$($l-routines)))
87
88 sources += $(addsuffix .c, $(filter-out $(elided-routines), $(tests)))
89
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))
93 foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
94 # Find all the files that have a generic version.
95 generic-dirs = $(..)sysdeps/generic $(..)sysdeps/ieee754 \
96 $(..)sysdeps/ieee754/flt-32 $(..)sysdeps/ieee754/dbl-64 \
97 $(..)sysdeps/ieee754/ldbl-96 $(..)sysdeps/ieee754/ldbl-128
98 try-sysdeps := $(foreach dir,$(generic-dirs),\
99 $(addprefix $(dir)/,$(+maybe-sysdeps)))
100 foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
101 +sysdeps := $(wildcard $(try-sysdeps))
102 foo:=$(shell echo 'generic +sysdeps=$(+sysdeps)'>&2)
103 +sysdep-names := $(sort $(foreach dir, $(generic-dirs),\
104 $(patsubst $(dir)/%,%,\
105 $(filter $(dir)/%,$(+sysdeps)))))
106 foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
107
108 ifdef subdir-dirs
109 vpath % $(subdir-dirs)
110 endif
111
112 # Now find all the sysdep versions of those files.
113 +sysdeps := $(foreach dir,$(sysdep_dirs) $(source_dirs),\
114 $(wildcard $(addprefix $(dir)/, \
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))
124 sources := $(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)) \
128 $(+subdir-nodist) $(dont_distribute)
129 foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
130 +tsrcs := $(filter-out $(+out), $(sources) $(all-headers)) $(+sysdeps)
131 foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
132 foo:=$(shell echo generated='$(generated)' >&2)
133 #generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
134 #foo:=$(shell echo now generated='$(generated)' >&2)
135 +tsrcs := $(filter-out $(generated),$(+tsrcs))
136 +tsrcs := $(sort $(filter-out $(+out),$(+tsrcs) $(distribute)))
137 foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
138 foo:=$(shell echo foobie, dammit! >&2)
139
140 ifndef tardir
141 export tardir := glibc-$(version)
142 endif
143
144 $(..)glibc-$(version):
145 ln -s . $@
146
147 #+tsrcs := $(+tsrcs) \
148 # TAGS
149 .PHONY: TAGS
150 TAGS: $(..)MakeTAGS
151 $(MAKE) -f $< $@ -o subdir_TAGS
152
153 ifdef subdir
154
155 foo:=$(shell echo subdir foo >&2)
156
157 +tsrcs := Makefile $(wildcard Versions) $(wildcard Depend) $(+tsrcs) \
158 $(addsuffix .c,$(others) $(test-srcs)) \
159 $(wildcard $(addsuffix .input,$(tests) $(test-srcs)))
160 +tardeps := $(strip $(+tsrcs))
161
162 verbose = v
163
164 .PHONY: dist
165 dist: $(..)$(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 ..."; \
168 tar $${c}h$(verbose)f dist.tar \
169 $(addprefix $(tardir)/$(subdir)/,$(filter-out $<,$^))
170
171 else # Parent makefile.
172
173 # Find what other things sysdep directories want to distribute.
174
175 foo:=$(shell echo parent foobie>&2)
176 +sysdep-distfiles := $(wildcard $(addsuffix /Dist,$(sysdep_dirs)))
177 foo:=$(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)
183 foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
184
185 +sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies syscalls.list\
186 configure configure.in Versions\
187 libm-test-ulps,\
188 $(addsuffix /$(file),$(sysdep_dirs)))) \
189 $(+sysdep-dist)
190
191 +tsrcs := $(+tsrcs) $(+sysdep-tsrcs) $(wildcard $(+sysdep-names:%=include/%))
192
193 ifeq ($(with-cvs),yes)
194 define autoconf-it
195 autoconf $(ACFLAGS) $< > $@.new
196 mv -f $@.new $@
197 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
198 endef
199 else
200 define autoconf-it
201 autoconf $(ACFLAGS) $< > $@.new
202 mv -f $@.new $@
203 endef
204 endif
205
206 configure: configure.in aclocal.m4; $(autoconf-it)
207 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
208
209 dist: $(tardir).tar.gz
210
211 subdir_dist: dist.tar
212 dist.tar: README $(tardir) $(+tsrcs)
213 tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
214
215 $(tardir).tar: dist.tar subdir_dist
216 @echo Files listed here have names exceeding 14 chars.
217 tar xfv $< -C $${TMPDIR-/tmp} | sed -n '/[^/]\{15,\}/p'
218 tar covf $@ -C $${TMPDIR-/tmp} $(tardir)
219 -rm -fr $${TMPDIR-/tmp}/$(tardir) dist.tar &
220
221 %.Z: %
222 compress -c $< > $@
223
224 %.gz: %
225 gzip -9 -v -c $< > $@
226
227 foo:=$(shell echo subdirs=$(subdirs) >&2)
228 dist-subdirs := $(addprefix dist-,$(subdirs)) # dist-manual
229 .PHONY: subdir_dist $(dist-subdirs)
230 subdir_dist: $(dist-subdirs)
231 $(dist-subdirs):
232 $(MAKE) -C $(patsubst dist-%,%,$@) dist
233
234 # This is here instead of in Makefile so it can use $(release) and $(version).
235 README: README.template version.h
236 -rm -f $@
237 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
238 # Make it unwritable so I won't change it by mistake.
239 chmod 444 $@
240 ifeq ($(with-cvs),yes)
241 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
242 endif
243
244
245 endif # Subdirectory vs. parent makefile
246 \f
247 # Get these things out of the environment because they take up lots of space.
248 unexport distribute generated
249
250 # Fnord.
251 export inhibit_mach_syscalls=t
252 export no_deps=t
253 export inhibit_interface_rules=t
This page took 0.04781 seconds and 5 git commands to generate.