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.
21 # Make the value empty so ifdef fails if it's $(-subdir).
29 include $(..)Makeconfig
31 foo:=$(shell echo 'distribute=$(distribute)'>&2)
32 foo:=$(shell echo 'foobar=$(filter %.c %.S %.s %.h,$(distribute))'>&2)
35 # Find all sysdep directories.
36 export sysdep_dirs := $(shell find $(..)sysdeps -type d \
37 ! -name CVS ! -name RCS -print)
39 # Defined by the parent.
40 sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
43 # Don't distribute add-on subdirs.
44 subdirs := $(filter-out $(add-ons),$(subdirs))
46 # Make sure both stdio and libio get in, whichever is in use.
47 subdirs += stdio libio
49 sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
50 ifdef sysdep-Subdir-files
51 subdirs := $(sort $(subdirs) \
52 $(shell sed -e 's/\#.*$$//' $(sysdep-Subdir-files)))
56 # Makefiles can define `source_dirs' to list nonstandard directories
57 # where source files might be found.
60 all-headers = $(filter-out $(sysdep_headers),$(headers))
62 +distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
63 inhibit_interface_rules=t inhibit_mach_syscalls=t \
64 subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
65 foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
66 all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
67 # Ignore subdir headers without top-level indirections.
68 all-headers := $(sort $(headers) $(wildcard $(all-headers)))
69 +subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
70 +subdir-headers := $(filter-out $(headers),$(all-headers))
72 foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
74 sources += $(addsuffix .c,$(elided-routines) \
75 $(foreach l,$(extra-libs),$($l-routines)))
77 # Find all sysdep sources and headers.
78 +maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
79 $(filter %.c %.S %.s %.h %.sub,$(distribute))
80 foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
81 # Find all the files that have a stub or generic version.
82 try-sysdeps := $(foreach dir,$(..)sysdeps/stub $(..)sysdeps/generic \
83 $(..)sysdeps/libm-ieee754,\
84 $(addprefix $(dir)/,$(+maybe-sysdeps)))
85 foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
86 +sysdeps := $(wildcard $(try-sysdeps))
87 foo:=$(shell echo 'stub/generic +sysdeps=$(+sysdeps)'>&2)
88 +sysdep-names := $(sort $(patsubst $(..)sysdeps/generic/%,%,\
89 $(patsubst $(..)sysdeps/stub/%,%,\
90 $(patsubst $(..)sysdeps/libm-ieee754/%,%,\
92 foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
95 vpath % $(subdir-dirs)
98 # Now find all the sysdep versions of those files.
99 +sysdeps := $(foreach dir,$(sysdep_dirs) $(source_dirs),\
100 $(wildcard $(addprefix $(dir)/, \
102 $(+sysdep-names:.c=.s) \
103 $(+sysdep-names:.c=.S) \
107 # Source and header files to go in the distribution tar file.
109 .S.s := $(wildcard $(sources:.c=.S) $(sources:.c=.s))
110 sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
112 +out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
113 $(addsuffix .c,$(sysdep_routines)) \
115 #foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
116 +tsrcs := $(filter-out $(+out), $(sources) $(all-headers) $(distribute)) \
118 foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
119 foo:=$(shell echo generated='$(generated)' >&2)
120 generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
121 foo:=$(shell echo now generated='$(generated)' >&2)
122 +tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
123 foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
124 foo:=$(shell echo foobie, dammit! >&2)
127 -include $(common-objpfx)version.mk
128 export tardir := glibc-$(version)
131 $(..)glibc-$(version):
134 #+tsrcs := $(+tsrcs) \
138 $(MAKE) -f $< $@ -o subdir_TAGS
142 foo:=$(shell echo subdir foo >&2)
144 +tsrcs := Makefile $(+tsrcs) \
145 $(addsuffix .c,$(others) $(tests)) \
146 $(wildcard $(addsuffix .input,$(tests)) \
147 $(addsuffix .args,$(tests)))
148 +tardeps := $(strip $(+tsrcs))
153 dist: $(..)$(tardir) $(+tardeps)
154 @cd ..; if test -f dist.tar; then c=u; else c=c; fi; \
155 $(+cmdecho) "cd ..; tar $${c}h$(verbose)f dist.tar ..."; \
156 tar $${c}h$(verbose)f dist.tar \
157 $(addprefix $(tardir)/$(subdir)/,$(filter-out $<,$^))
159 else # Parent makefile.
161 # Find what other things sysdep directories want to distribute.
163 foo:=$(shell echo parent foobie>&2)
164 +sysdep-distfiles := $(wildcard $(addsuffix /Dist,$(sysdep_dirs)))
165 foo:=$(shell echo +sysdep-distfiles='$(+sysdep-distfiles)'>&2)
166 +sysdep-dist := $(foreach file,$(+sysdep-distfiles),\
167 $(addprefix $(dir $(file)), \
168 $(shell sed -e 's/\#.*$$//' $(file)))) \
169 $(+sysdep-distfiles) \
170 $(sysdep-Subdir-files)
171 foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
173 +sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies syscalls.list\
174 configure configure.in,\
175 $(addsuffix /$(file),$(sysdep_dirs)))) \
178 +tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
181 autoconf $(ACFLAGS) $< > $@.new
183 test ! -d CVS || cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
186 configure: configure.in aclocal.m4; $(autoconf-it)
187 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
190 dist: $(tardir).tar.gz
192 subdir_dist: dist.tar
193 dist.tar: $(tardir) $(+tsrcs)
194 tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
196 $(tardir).tar: dist.tar subdir_dist
197 @echo Files listed here have names exceeding 14 chars.
198 tar xfv $< -C /tmp | sed -n '/[^/]\{15,\}/p'
199 tar covf $@ -C /tmp $(tardir)
200 -rm -fr /tmp/$(tardir) dist.tar &
206 gzip -9 -v -c $< > $@
208 foo:=$(shell echo subdirs=$(subdirs) >&2)
209 dist-subdirs := $(addprefix dist-,$(subdirs)) # dist-manual
210 .PHONY: subdir_dist $(dist-subdirs)
211 subdir_dist: $(dist-subdirs)
213 $(MAKE) -C $(patsubst dist-%,%,$@) dist
215 # This is here instead of in Makefile so it can use $(release) and $(version).
216 README: README.template version.c
218 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
219 # Make it unwritable so I won't change it by mistake.
221 test ! -d CVS || cvs commit -m'Remade for $(release)-$(version)' $@
224 endif # Subdirectory vs. parent makefile
226 # Get these things out of the environment because they take up lots of space.
227 unexport distribute generated
230 export inhibit_mach_syscalls=t
232 export inhibit_interface_rules=t