*** empty log message ***
[glibc.git] / Make-dist
blob10ea43c06bdd0573f8d48bdc2ea4d78b42810377
1 # Copyright (C) 1991, 92, 93, 94, 95, 96 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
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
19 dist:
21 # Make the value empty so ifdef fails if it's $(-subdir).
22 subdir := $(subdir)
23 ifdef subdir
24 .. := ../
25 else
26 .. :=
27 endif
29 include $(..)Makeconfig
31 foo:=$(shell echo 'distribute=$(distribute)'>&2)
32 foo:=$(shell echo 'foobar=$(filter %.c %.S %.s %.h,$(distribute))'>&2)
34 ifndef sysdep_dirs
35 # Find all sysdep directories.
36 export sysdep_dirs := $(shell find $(..)sysdeps -type d \
37                                    ! -name CVS ! -name RCS -print)
38 else
39 # Defined by the parent.
40 sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
41 endif
43 # Make sure both stdio and libio get in, whichever is in use.
44 subdirs += stdio libio
46 sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
47 ifdef sysdep-Subdir-files
48 subdirs := $(sort $(subdirs) \
49                   $(shell sed -e 's/\#.*$$//' $(sysdep-Subdir-files)))
50 endif
53 # Makefiles can define `source_dirs' to list nonstandard directories
54 # where source files might be found.
56 ifdef   subdir
57 all-headers = $(filter-out $(sysdep_headers),$(headers))
58 else
59 +distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
60                      inhibit_interface_rules=t inhibit_mach_syscalls=t \
61                      subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
62 foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
63 all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
64 # Ignore subdir headers without top-level indirections.
65 all-headers := $(sort $(headers) $(wildcard $(all-headers)))
66 +subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
67 +subdir-headers := $(filter-out $(headers),$(all-headers))
68 endif
69 foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
71 sources += $(addsuffix .c,$(elided-routines) \
72                           $(foreach l,$(extra-libs),$($l-routines)))
74 # Find all sysdep sources and headers.
75 +maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
76                   $(filter %.c %.S %.s %.h %.sub,$(distribute))
77 foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
78 # Find all the files that have a stub or generic version.
79 try-sysdeps := $(foreach dir,$(..)sysdeps/stub $(..)sysdeps/generic \
80                              $(..)sysdeps/libm-ieee754,\
81                              $(addprefix $(dir)/,$(+maybe-sysdeps)))
82 foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
83 +sysdeps := $(wildcard $(try-sysdeps))
84 foo:=$(shell echo 'stub/generic +sysdeps=$(+sysdeps)'>&2)
85 +sysdep-names := $(sort $(patsubst $(..)sysdeps/generic/%,%,\
86                                    $(patsubst $(..)sysdeps/stub/%,%,\
87                                    $(patsubst $(..)sysdeps/libm-ieee754/%,%,\
88                                               $(+sysdeps)))))
89 foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
91 ifdef subdir-dirs
92 vpath % $(subdir-dirs)
93 endif
95 # Now find all the sysdep versions of those files.
96 +sysdeps := $(foreach dir,$(sysdep_dirs) $(source_dirs),\
97                       $(wildcard $(addprefix $(dir)/, \
98                                              $(+sysdep-names) \
99                                              $(+sysdep-names:.c=.s) \
100                                              $(+sysdep-names:.c=.S) \
101                                   )))
104 # Source and header files to go in the distribution tar file.
106 .S.s := $(wildcard $(sources:.c=.S) $(sources:.c=.s))
107 sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
109 +out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
110         $(addsuffix .c,$(sysdep_routines)) \
111         $(+subdir-nodist)
112 #foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
113 +tsrcs  := $(filter-out $(+out) $(addprefix %/,$(+out)), \
114                         $(sources) $(all-headers) $(distribute)) \
115            $(+sysdeps)
116 foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
117 foo:=$(shell echo generated='$(generated)' >&2)
118 generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
119 foo:=$(shell echo now generated='$(generated)' >&2)
120 +tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
121 foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
122 foo:=$(shell echo foobie, dammit! >&2)
124 ifndef tardir
125 -include $(common-objpfx)version.mk
126 export tardir := glibc-$(version)
127 endif
129 $(..)glibc-$(version):
130         ln -s . $@
132 +tsrcs := $(+tsrcs) \
133           TAGS
134 .PHONY: TAGS
135 TAGS: $(..)MakeTAGS
136         $(MAKE) -f $< $@ -o subdir_TAGS
138 ifdef      subdir
140 foo:=$(shell echo subdir foo >&2)
142 +tsrcs := Makefile $(+tsrcs)                            \
143           $(addsuffix .c,$(others) $(tests))            \
144           $(wildcard $(addsuffix .input,$(tests))       \
145           $(addsuffix .args,$(tests)))
146 +tardeps := $(strip $(+tsrcs))
148 verbose = v
150 .PHONY: dist
151 dist: $(..)$(tardir) $(+tardeps)
152         @cd ..; if test -f dist.tar; then c=u; else c=c; fi;    \
153         $(+cmdecho) "cd ..; tar $${c}h$(verbose)f dist.tar ...";        \
154         tar $${c}h$(verbose)f dist.tar \
155             $(addprefix $(tardir)/$(subdir)/,$(filter-out $<,$^))
157 else    # Parent makefile.
159 # Find what other things sysdep directories want to distribute.
161 foo:=$(shell echo parent foobie>&2)
162 +sysdep-distfiles := $(wildcard $(addsuffix /Dist,$(sysdep_dirs)))
163 foo:=$(shell echo +sysdep-distfiles='$(+sysdep-distfiles)'>&2)
164 +sysdep-dist := $(foreach file,$(+sysdep-distfiles),\
165                           $(addprefix $(dir $(file)), \
166                                       $(shell sed -e 's/\#.*$$//' $(file)))) \
167                 $(+sysdep-distfiles) \
168                 $(sysdep-Subdir-files)
169 foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
171 +sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies syscalls.list\
172                                            configure configure.in,\
173                                       $(addsuffix /$(file),$(sysdep_dirs)))) \
174                  $(+sysdep-dist)
176 +tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
178 define autoconf-it
179 autoconf $(ACFLAGS) $< > $@.new
180 mv -f $@.new $@
181 test ! -d CVS || cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
182 endef
184 configure: configure.in aclocal.m4; $(autoconf-it)
185 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
187 .PHONY: dist
188 dist: $(tardir).tar.gz
190 subdir_dist: dist.tar
191 dist.tar: $(tardir) $(+tsrcs)
192         tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
194 $(tardir).tar: dist.tar subdir_dist
195         @echo Files listed here have names exceeding 14 chars.
196         tar xfv $< -C /tmp | sed -n '/[^/]\{15,\}/p'
197         tar covf $@ -C /tmp $(tardir)
198         -rm -fr /tmp/$(tardir) &
200 %.Z: %
201         compress -c $< > $@
203 %.gz: %
204         gzip -9 -v -c $< > $@
206 foo:=$(shell echo subdirs=$(subdirs) >&2)
207 dist-subdirs := $(addprefix dist-,$(subdirs)) # dist-manual
208 .PHONY: subdir_dist $(dist-subdirs)
209 subdir_dist: $(dist-subdirs)
210 $(dist-subdirs):
211         $(MAKE) -C $(patsubst dist-%,%,$@) dist
213 # This is here instead of in Makefile so it can use $(release) and $(version).
214 README: README.template version.c
215         -rm -f $@
216         sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
217 # Make it unwritable so I won't change it by mistake.
218         chmod 444 $@
219         test ! -d CVS || cvs commit -m'Remade for $(release)-$(version)' $@
222 endif   # Subdirectory vs. parent makefile
224 # Get these things out of the environment because they take up lots of space.
225 unexport distribute generated
227 # Fnord.
228 export inhibit_mach_syscalls=t
229 export no_deps=t
230 export inhibit_interface_rules=t