copied from progressive
[deliverable/binutils-gdb.git] / test-build.mk
CommitLineData
c12d9b4c
RP
1###
2### Makefile used to three-stage build a tree of source code. Also used to
3### compile other bundles, first with cc, then with gcc.
4###
5
6### This file was written and is maintained by K. Richard Pixley,
7### <rich@cygnus.com>.
8
9### Every invocation of this Makefile needs to have a variable set (host),
10### which is the named used for ./configure, and also the prefix for the
11### various files and directories used in a three stage.
12
13ifndef host
14error:; @echo You must set the variable \"host\" to use this Makefile ; exit 1
15else
16
17### from here to very near the end of the file is the real guts of this
18### Makefile, and it is not seen if the variable 'host' is not set
19
20###
21### START EDITTING HERE!!!
22### These things will need to be set differently for each release.
23###
24
25### from which cvs tree are we working?
26TREE := progressive
27
28### binaries should be installed into?
29ROOTING := /usr/cygnus
30
31### When working from a tagged set of source, this should be the tag. If not,
32### then set the macro to be empty.
33CVS_TAG := -r emacs-920529
34
35### The name of the cvs module for this release. The intersection of
36### CVS_MODULE and CVS_TAG defines the source files in this release.
37CVS_MODULE := progressive-emacs
38
39### Historically, this was identical to CVS_TAG. This is changing.
40RELEASE_TAG := progressive-920529
41
42### Historically, binaries were installed here. This is changing.
43release_root := $(ROOTING)/$(RELEASE_TAG)
44
45### STOP EDITTING HERE!!!
46### With luck, eventually, nothing else will need to be editted.
47
48TIME := time
49GCC := gcc -O
50GNU_MAKE := /usr/latest/bin/make
51override MAKE := make
52override MAKEFLAGS :=
53override MFLAGS :=
54
55SHELL := /bin/sh
56
57.NOEXPORT:
58
59FLAGS_TO_PASS := \
60 "GCC=$(GCC)" \
61 "TIME=$(TIME)" \
62 "MF=$(MF)"
63
64### general config stuff
65WORKING_DIR := $(host)-objdir
66STAGE1DIR := $(WORKING_DIR).1
67STAGE2DIR := $(WORKING_DIR).2
68STAGE3DIR := $(WORKING_DIR).3
69HOLESDIR := $(host)-holes
70
71.PHONY: all
72all: $(TREE) do1 do2 do3 comparison
73
74.PHONY: do1
75do1: $(host)-stamp-holes $(host)-stamp-stage1
76
77$(host)-stamp-stage1:
78 if [ -d $(STAGE1DIR) ] ; then \
79 mv $(STAGE1DIR) $(WORKING_DIR) ; \
80 else \
81 true ; \
82 fi
83 PATH=`pwd`/$(HOLESDIR) ; \
84 export PATH ; \
85 SHELL=sh ; export SHELL ; \
86 $(TIME) $(GNU_MAKE) $(host)-stamp-stage1-installed host=$(host) $(FLAGS_TO_PASS)
87 touch $(host)-stamp-stage1
88 mv $(WORKING_DIR) $(STAGE1DIR)
89
90$(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked
91 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) install host=$(host))
92 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) install-info host=$(host))
93 touch $@
94
95$(host)-stamp-stage1-checked: $(host)-stamp-stage1-built
96# (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) check host=$(host))
97 touch $@
98
99$(host)-stamp-stage1-built: $(host)-stamp-stage1-configured
100 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) all host=$(host))
101 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) info host=$(host))
102 touch $@
103
104$(host)-stamp-stage1-configured:
105 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
106 (cd $(WORKING_DIR) ; \
107 $(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
108 -prefix=$(release_root) \
109 -exec_prefix=$(release_root)/H-$(host))
110 touch $@
111
112.PHONY: do2
113do2: $(HOLESDIR) $(host)-stamp-stage2
114
115$(host)-stamp-stage2:
116 if [ -d $(STAGE2DIR) ] ; then \
117 mv $(STAGE2DIR) $(WORKING_DIR) ; \
118 else \
119 true ; \
120 fi
121 PATH=$(release_root)/H-$(host)/bin:`pwd`/$(HOLESDIR) ; \
122 export PATH ; \
123 SHELL=sh ; export SHELL ; \
124 $(TIME) $(MAKE) -w $(STAGE2DIR) host=$(host) $(FLAGS_TO_PASS)
125 touch $(host)-stamp-stage2
126
127$(STAGE2DIR): $(host)-stamp-stage2-installed
128 mv $(WORKING_DIR) $(STAGE2DIR)
129
130$(host)-stamp-stage2-installed: $(host)-stamp-stage2-checked
131 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" install host=$(host))
132 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" install-info host=$(host))
133 touch $@
134
135$(host)-stamp-stage2-checked: $(host)-stamp-stage2-built
136# (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" check host=$(host))
137 touch $@
138
139$(host)-stamp-stage2-built: $(host)-stamp-stage2-configured
140 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" all host=$(host))
141 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" info host=$(host))
142 touch $@
143
144$(host)-stamp-stage2-configured:
145 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
146 (cd $(WORKING_DIR) ; \
147 $(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
148 -prefix=$(release_root) \
149 -exec_prefix=$(release_root)/H-$(host))
150 touch $@
151
152.PHONY: do3
153do3: $(HOLESDIR) $(host)-stamp-stage3
154
155$(host)-stamp-stage3:
156 if [ -d $(STAGE3DIR) ] ; then \
157 mv $(STAGE3DIR) $(WORKING_DIR) ; \
158 else \
159 true ; \
160 fi
161 PATH=$(release_root)/H-$(host)/bin:`pwd`/$(HOLESDIR) ; \
162 export PATH ; \
163 SHELL=sh ; export SHELL ; \
164 $(TIME) $(MAKE) -w $(STAGE3DIR) host=$(host) $(FLAGS_TO_PASS)
165 touch $(host)-stamp-stage3
166
167$(STAGE3DIR): $(host)-stamp-stage3-checked
168 mv $(WORKING_DIR) $(STAGE3DIR)
169
170$(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked
171 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" install host=$(host))
172 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" install-info host=$(host))
173 touch $@
174
175$(host)-stamp-stage3-checked: $(host)-stamp-stage3-built
176# (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" check host=$(host))
177 touch $@
178
179$(host)-stamp-stage3-built: $(host)-stamp-stage3-configured
180 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" all host=$(host))
181 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" info host=$(host))
182 touch $@
183
184$(host)-stamp-stage3-configured:
185 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
186 (cd $(WORKING_DIR) ; \
187 $(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
188 -prefix=$(release_root) \
189 -exec_prefix=$(release_root)/H-$(host))
190 touch $@
191
192# These things are needed by a three-stage, but are not included locally.
193
194HOLES := \
195 [ \
196 ar \
197 as \
198 awk \
199 basename \
200 cat \
201 cc \
202 chmod \
203 cmp \
204 cp \
205 date \
206 diff \
207 echo \
208 egrep \
209 ex \
210 expr \
211 find \
212 grep \
213 hostname \
214 install \
215 ld \
216 lex \
217 ln \
218 ls \
219 make \
220 mkdir \
221 mv \
222 nm \
223 pwd \
224 ranlib \
225 rm \
226 rmdir \
227 sed \
228 sh \
229 sort \
230 test \
231 time \
232 touch \
233 tr \
234 true \
235 whoami
236
237### so far only sun make supports VPATH
238ifeq ($(subst sun3,sun4,$(host)),sun4)
239MAKE_HOLE :=
240else
241MAKE_HOLE := make
242endif
243
244### rs6000 as is busted. We cache a patched version in unsupported.
245ifeq ($(subst sun3,rs6000,$(host)),rs6000)
246AS_HOLE := as
247else
248AS_HOLE :=
249endif
250
251### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required.
252PARTIAL_HOLES := \
253 $(AS_HOLE) \
254 $(MAKE_HOLE) \
255 flex \
256 m4
257
258### look in these directories for things missing from a three-stage
259HOLE_DIRS := \
260 /bin \
261 /usr/bin \
262 /usr/ucb \
263 /usr/unsupported/bin
264
265### look in these directories for alternate versions of some tools.
266PARTIAL_HOLE_DIRS := \
267 /usr/latest/bin \
268 /usr/progressive/bin \
269 /usr/vintage/bin \
270 /usr/unsupported/bin
271
272$(HOLESDIR): $(host)-stamp-holes
273
274$(host)-stamp-holes:
275 -rm -rf $(HOLESDIR)
276 -mkdir $(HOLESDIR)
277 for i in $(HOLES) ; do \
278 found= ; \
279 for j in $(HOLE_DIRS) ; do \
280 if [ -x $$j/$$i ] ; then \
281 cp $$j/$$i $(HOLESDIR) ; \
282 echo $$i from $$j ; \
283 found=t ; \
284 break ; \
285 fi ; \
286 done ; \
287 case "$$found" in \
288 t) ;; \
289 *) echo $$i is NOT found ;; \
290 esac ; \
291 done
292 for i in $(PARTIAL_HOLES) ; do \
293 found= ; \
294 for j in $(PARTIAL_HOLE_DIRS) ; do \
295 if [ -x $$j/$$i ] ; then \
296 rm -f $(HOLESDIR)/$$i ; \
297 cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \
298 echo $$i from $$j ; \
299 found=t ; \
300 break ; \
301 fi ; \
302 done ; \
303 case "$$found" in \
304 t) ;; \
305 *) echo $$i is NOT found ;; \
306 esac ; \
307 done
308 touch $(host)-stamp-holes
309
310.PHONY: comparison
311comparison:
312ifeq ($(subst rs6000,iris4,$(subst decstation,iris4,$(host))),iris4)
313 for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
314 tail +10c $(STAGE2DIR)/$$i > foo1 ; \
315 tail +10c $(STAGE3DIR)/$$i > foo2 ; \
316 cmp foo1 foo2 || echo $$i ; \
317 done
318else
319 for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
320 cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i ; \
321 done
322endif
323
324.PHONY: clean
325clean:
326 rm -rf $(HOLESDIR) $(WORKING_DIR)* $(host)-stamp-* *~
327
328.PHONY: very
329very:
330 rm -rf $(TREE)
331
332$(TREE):
333 $(TIME) cvs co $(CVS_TAG) $(CVS_MODULE)
334
335force:
336
337endif # host
338
339### Local Variables:
340### fill-column: 131
341### End:
This page took 0.033792 seconds and 4 git commands to generate.