Don't die on TYPE_CODE_UNDEF nodes as base classes.
[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?
8b510607 26TREE := devo
c12d9b4c
RP
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.
8b510607
RP
33#CVS_TAG := -r emacs-920529
34CVS_TAG :=
c12d9b4c
RP
35
36### The name of the cvs module for this release. The intersection of
37### CVS_MODULE and CVS_TAG defines the source files in this release.
8b510607 38CVS_MODULE := devo
c12d9b4c
RP
39
40### Historically, this was identical to CVS_TAG. This is changing.
8b510607 41RELEASE_TAG := latest
c12d9b4c
RP
42
43### Historically, binaries were installed here. This is changing.
44release_root := $(ROOTING)/$(RELEASE_TAG)
45
46### STOP EDITTING HERE!!!
47### With luck, eventually, nothing else will need to be editted.
48
49TIME := time
50GCC := gcc -O
0986bf1b 51GNU_MAKE := /usr/latest/bin/make -f test-build.mk
c12d9b4c
RP
52override MAKE := make
53override MAKEFLAGS :=
54override MFLAGS :=
55
56SHELL := /bin/sh
57
58.NOEXPORT:
59
60FLAGS_TO_PASS := \
61 "GCC=$(GCC)" \
62 "TIME=$(TIME)" \
63 "MF=$(MF)"
64
65### general config stuff
66WORKING_DIR := $(host)-objdir
67STAGE1DIR := $(WORKING_DIR).1
68STAGE2DIR := $(WORKING_DIR).2
69STAGE3DIR := $(WORKING_DIR).3
7bea9148 70INPLACEDIR := $(host)-in-place
c12d9b4c
RP
71HOLESDIR := $(host)-holes
72
73.PHONY: all
7bea9148
RP
74all: $(TREE)-stamp-co do1 do2 do3 comparison
75
76.PHONY: in-place
77in-place: $(host)-stamp-in-place
78
79$(host)-stamp-in-place: $(TREE)-stamp-co
80 PATH=/bin:/usr/bin:/usr/ucb ; \
81 export PATH ; \
82 SHELL=/bin/sh ; export SHELL ; \
83 $(TIME) $(GNU_MAKE) $(host)-stamp-in-place-installed host=$(host) $(FLAGS_TO_PASS)
84 touch $@
85 mv $(INPLACEDIR) $(STAGE1DIR)
86
87$(host)-stamp-in-place-installed: $(host)-stamp-in-place-checked
88 (cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(MF) install host=$(host))
89 (cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(MF) install-info host=$(host))
90 touch $@
91
92$(host)-stamp-in-place-checked: $(host)-stamp-in-place-built
93# (cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(MF) check host=$(host))
94 touch $@
95
96$(host)-stamp-in-place-built: $(host)-stamp-in-place-configured
97 (cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(MF) all host=$(host))
98 (cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(MF) info host=$(host))
99 touch $@
100
101$(host)-stamp-in-place-configured: $(host)-stamp-in-place-cp
102 (cd $(INPLACEDIR) ; \
103 $(TIME) ./configure $(host) -v \
104 -prefix=$(release_root) \
105 -exec_prefix=$(release_root)/H-$(host))
106 touch $@
107
108$(host)-stamp-in-place-cp:
109 rm -rf $(INPLACEDIR)
110 mkdir $(INPLACEDIR)
111 (cd $(TREE) ; tar cf - .) | (cd $(INPLACEDIR) ; tar xf -)
112 touch $@
c12d9b4c
RP
113
114.PHONY: do1
115do1: $(host)-stamp-holes $(host)-stamp-stage1
116
117$(host)-stamp-stage1:
118 if [ -d $(STAGE1DIR) ] ; then \
119 mv $(STAGE1DIR) $(WORKING_DIR) ; \
120 else \
121 true ; \
122 fi
123 PATH=`pwd`/$(HOLESDIR) ; \
124 export PATH ; \
125 SHELL=sh ; export SHELL ; \
126 $(TIME) $(GNU_MAKE) $(host)-stamp-stage1-installed host=$(host) $(FLAGS_TO_PASS)
7bea9148 127 touch $@
c12d9b4c
RP
128 mv $(WORKING_DIR) $(STAGE1DIR)
129
130$(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked
131 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) install host=$(host))
132 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) install-info host=$(host))
133 touch $@
134
135$(host)-stamp-stage1-checked: $(host)-stamp-stage1-built
136# (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) check host=$(host))
137 touch $@
138
139$(host)-stamp-stage1-built: $(host)-stamp-stage1-configured
140 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) all host=$(host))
141 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) info host=$(host))
142 touch $@
143
144$(host)-stamp-stage1-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: do2
153do2: $(HOLESDIR) $(host)-stamp-stage2
154
155$(host)-stamp-stage2:
156 if [ -d $(STAGE2DIR) ] ; then \
157 mv $(STAGE2DIR) $(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 $(STAGE2DIR) host=$(host) $(FLAGS_TO_PASS)
7bea9148 165 touch $@
c12d9b4c
RP
166
167$(STAGE2DIR): $(host)-stamp-stage2-installed
168 mv $(WORKING_DIR) $(STAGE2DIR)
169
170$(host)-stamp-stage2-installed: $(host)-stamp-stage2-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-stage2-checked: $(host)-stamp-stage2-built
176# (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" check host=$(host))
177 touch $@
178
179$(host)-stamp-stage2-built: $(host)-stamp-stage2-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-stage2-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.PHONY: do3
193do3: $(HOLESDIR) $(host)-stamp-stage3
194
195$(host)-stamp-stage3:
196 if [ -d $(STAGE3DIR) ] ; then \
197 mv $(STAGE3DIR) $(WORKING_DIR) ; \
198 else \
199 true ; \
200 fi
201 PATH=$(release_root)/H-$(host)/bin:`pwd`/$(HOLESDIR) ; \
202 export PATH ; \
203 SHELL=sh ; export SHELL ; \
204 $(TIME) $(MAKE) -w $(STAGE3DIR) host=$(host) $(FLAGS_TO_PASS)
7bea9148 205 touch $@
c12d9b4c
RP
206
207$(STAGE3DIR): $(host)-stamp-stage3-checked
208 mv $(WORKING_DIR) $(STAGE3DIR)
209
210$(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked
211 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" install host=$(host))
212 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" install-info host=$(host))
213 touch $@
214
215$(host)-stamp-stage3-checked: $(host)-stamp-stage3-built
216# (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" check host=$(host))
217 touch $@
218
219$(host)-stamp-stage3-built: $(host)-stamp-stage3-configured
220 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" all host=$(host))
221 (cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) "CC=$(GCC)" info host=$(host))
222 touch $@
223
224$(host)-stamp-stage3-configured:
225 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
226 (cd $(WORKING_DIR) ; \
227 $(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
228 -prefix=$(release_root) \
229 -exec_prefix=$(release_root)/H-$(host))
230 touch $@
231
232# These things are needed by a three-stage, but are not included locally.
233
234HOLES := \
235 [ \
236 ar \
237 as \
238 awk \
239 basename \
240 cat \
241 cc \
242 chmod \
243 cmp \
244 cp \
245 date \
246 diff \
247 echo \
248 egrep \
249 ex \
250 expr \
251 find \
252 grep \
253 hostname \
254 install \
255 ld \
256 lex \
257 ln \
258 ls \
259 make \
260 mkdir \
261 mv \
262 nm \
263 pwd \
264 ranlib \
265 rm \
266 rmdir \
267 sed \
268 sh \
269 sort \
270 test \
271 time \
272 touch \
273 tr \
274 true \
275 whoami
276
277### so far only sun make supports VPATH
278ifeq ($(subst sun3,sun4,$(host)),sun4)
279MAKE_HOLE :=
280else
281MAKE_HOLE := make
282endif
283
284### rs6000 as is busted. We cache a patched version in unsupported.
285ifeq ($(subst sun3,rs6000,$(host)),rs6000)
286AS_HOLE := as
287else
288AS_HOLE :=
289endif
290
291### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required.
292PARTIAL_HOLES := \
293 $(AS_HOLE) \
294 $(MAKE_HOLE) \
295 flex \
296 m4
297
298### look in these directories for things missing from a three-stage
299HOLE_DIRS := \
300 /bin \
301 /usr/bin \
302 /usr/ucb \
303 /usr/unsupported/bin
304
305### look in these directories for alternate versions of some tools.
306PARTIAL_HOLE_DIRS := \
307 /usr/latest/bin \
308 /usr/progressive/bin \
309 /usr/vintage/bin \
310 /usr/unsupported/bin
311
312$(HOLESDIR): $(host)-stamp-holes
313
314$(host)-stamp-holes:
315 -rm -rf $(HOLESDIR)
316 -mkdir $(HOLESDIR)
317 for i in $(HOLES) ; do \
318 found= ; \
319 for j in $(HOLE_DIRS) ; do \
320 if [ -x $$j/$$i ] ; then \
321 cp $$j/$$i $(HOLESDIR) ; \
322 echo $$i from $$j ; \
323 found=t ; \
324 break ; \
325 fi ; \
326 done ; \
327 case "$$found" in \
328 t) ;; \
329 *) echo $$i is NOT found ;; \
330 esac ; \
331 done
332 for i in $(PARTIAL_HOLES) ; do \
333 found= ; \
334 for j in $(PARTIAL_HOLE_DIRS) ; do \
335 if [ -x $$j/$$i ] ; then \
336 rm -f $(HOLESDIR)/$$i ; \
337 cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \
338 echo $$i from $$j ; \
339 found=t ; \
340 break ; \
341 fi ; \
342 done ; \
343 case "$$found" in \
344 t) ;; \
345 *) echo $$i is NOT found ;; \
346 esac ; \
347 done
7bea9148 348 touch $@
c12d9b4c
RP
349
350.PHONY: comparison
351comparison:
352ifeq ($(subst rs6000,iris4,$(subst decstation,iris4,$(host))),iris4)
353 for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
354 tail +10c $(STAGE2DIR)/$$i > foo1 ; \
355 tail +10c $(STAGE3DIR)/$$i > foo2 ; \
356 cmp foo1 foo2 || echo $$i ; \
357 done
358else
359 for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
360 cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i ; \
361 done
362endif
363
364.PHONY: clean
365clean:
7bea9148 366 rm -rf $(HOLESDIR) $(INPLACEDIR) $(WORKING_DIR)* $(host)-stamp-* *~
c12d9b4c
RP
367
368.PHONY: very
369very:
370 rm -rf $(TREE)
371
7bea9148
RP
372.PHONY: $(TREE)
373$(TREE): $(TREE)-stamp-co
374
375$(TREE)-stamp-co:
376 rm -rf $(TREE)
c12d9b4c 377 $(TIME) cvs co $(CVS_TAG) $(CVS_MODULE)
7bea9148 378 touch $@
c12d9b4c
RP
379
380force:
381
382endif # host
383
384### Local Variables:
385### fill-column: 131
386### End:
This page took 0.036762 seconds and 4 git commands to generate.