recognize m88110
[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
5ba00487
DZ
6###
7### USE OF THIS FILE REQUIRES GNU MAKE!!!
8###
9
10### The first versions of the file were written by Rich Pixley (rich@cygnus.com).
11### Many subsequent additions (and current maintainance by) david d `zoo' zuhn,
12### (zoo@cygnus.com).
c12d9b4c
RP
13
14### Every invocation of this Makefile needs to have a variable set (host),
15### which is the named used for ./configure, and also the prefix for the
16### various files and directories used in a three stage.
17
35eae2d8
ILT
18### The variable target may be set for the target of a cross-compilation.
19
20### The variable build may be to build a tree on a machine other than the host.
21
c12d9b4c 22ifndef host
5ba00487
DZ
23error:
24 @echo You must set the variable \"host\" to use this Makefile ; exit 1
c12d9b4c
RP
25else
26
27### from here to very near the end of the file is the real guts of this
28### Makefile, and it is not seen if the variable 'host' is not set
29
c12d9b4c 30### from which cvs tree are we working?
8b510607 31TREE := devo
c12d9b4c 32
7f0d689a 33include $(TREE)/release-info
c12d9b4c 34
c12d9b4c 35
5ba00487 36TIME := time
04a59f79 37GCC := $(host)-gcc -O
301c3fef 38GNUC := CC="$(GCC)"
5ba00487 39CFLAGS := -g
04a59f79 40CXXFLAGS := -g -O
5ba00487 41GNU_MAKE := /usr/latest/bin/make -w
04a59f79 42MAKEINFOFLAGS :=
c12d9b4c 43
5ba00487
DZ
44override MAKE := make
45override MFLAGS :=
46#override MAKEFLAGS :=
c12d9b4c 47
5ba00487 48SHELL := /bin/sh
c12d9b4c 49
04a59f79
DZ
50ifndef build
51build := $(host)
52endif
53
54ifndef target
55target := $(host)
56endif
57
58ifneq ($(build),$(host))
35eae2d8
ILT
59
60# We are building on a machine other than the host. We rely upon
61# previously built cross-compilers from the build machine to the host
62# (used to build the executables) and from the build machine to the
63# target (used to build the libraries).
64
65AR := $(host)-ar
66AR_FOR_TARGET := $(target)-ar
67AS := $(host)-as
68AS_FOR_TARGET := $(target)-as
69CC := $(host)-gcc
70CC_FOR_BUILD := gcc
71CC_FOR_TARGET := $(target)-gcc
72CXX := $(host)-c++
73CXX_FOR_TARGET := $(target)-c++
74GCC := $(host)-gcc -O
75GXX := $(host)-g++
76GXX_FOR_TARGET := $(target)-g++
77HOST_PREFIX := $(build)-
78HOST_PREFIX_1 := $(build)-
79MAKEINFO := makeinfo
80MUNCH_NM := $(host)-nm
81NM := $(host)-nm
82NM_FOR_TARGET := $(target)-nm
83RANLIB := $(host)-ranlib
84RANLIB_FOR_TARGET := $(target)-ranlib
85
86FLAGS_TO_PASS := \
87 "AR=$(AR)" \
88 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
89 "AS=$(AS)" \
90 "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
91 "CC=$(CC)" \
92 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
93 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
94 "CXX=$(CXX)" \
95 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
96 "CFLAGS=$(CFLAGS)" \
04a59f79 97 "CXXFLAGS=$(CXXFLAGS)" \
35eae2d8
ILT
98 "GCC=$(GCC)" \
99 "HOST_PREFIX=$(HOST_PREFIX)" \
100 "HOST_PREFIX_1=$(HOST_PREFIX_1)" \
101 "MAKEINFO=$(MAKEINFO)" \
04a59f79 102 "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
35eae2d8
ILT
103 "MF=$(MF)" \
104 "MUNCH_NM=$(MUNCH_NM)" \
105 "NM=$(NM)" \
106 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
107 "RANLIB=$(RANLIB)" \
108 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
109 "RELEASE_TAG=$(RELEASE_TAG)" \
110 "TIME=$(TIME)" \
111 "build=$(build)" \
112 "host=$(host)"
113
114# We must pass the build cross host tools in the environment of
115# configure, so that autoconf scripts will run the right programs.
116configenv := AR="$(AR)" CC="$(CC)" RANLIB="$(RANLIB)"
117
118else
119
120# This is a normal build on the host machine.
121
c12d9b4c
RP
122FLAGS_TO_PASS := \
123 "GCC=$(GCC)" \
5ba00487 124 "CFLAGS=$(CFLAGS)" \
04a59f79 125 "CXXFLAGS=$(CXXFLAGS)" \
c12d9b4c 126 "TIME=$(TIME)" \
04a59f79 127 "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
5ba00487 128 "MF=$(MF)" \
12eda620
ILT
129 "host=$(host)" \
130 "RELEASE_TAG=$(RELEASE_TAG)"
5ba00487 131
301482c7
DZ
132ifneq '$(CC)' 'cc'
133FLAGS_TO_PASS := "CC=$(CC)" $(FLAGS_TO_PASS)
134endif
135
35eae2d8
ILT
136configenv :=
137
138endif
139
5ba00487 140
35eae2d8 141# These are the prefixes used for Cygnus builds.
43ba04b1 142prefixes = --prefix=$(release_root) --exec-prefix=$(release_root)/H-$(host)
5ba00487 143
35eae2d8 144relbindir = $(release_root)/H-$(host)/bin
c12d9b4c
RP
145
146### general config stuff
5ba00487
DZ
147WORKING_DIR := $(host)-objdir
148STAGE1DIR := $(WORKING_DIR).1
149STAGE2DIR := $(WORKING_DIR).2
150STAGE3DIR := $(WORKING_DIR).3
151INPLACEDIR := $(host)-in-place
35eae2d8
ILT
152
153# Arrange to find the needed programs. If we are building on a
154# machine other than the host, we must find the cross-compilers.
155
04a59f79 156ifneq ($(build),$(host))
35eae2d8
ILT
157
158holesys := $(build)
159HOLESSTAMP := $(holesys)-stamp-holes $(build)-x-$(host)-stamp-holes $(build)-x-$(target)-stamp-holes
160HOLESDIR := $(holesys)-holes
161BUILD_HOST_HOLES_DIR := $(build)-x-$(host)-holes
162BUILD_TARGET_HOLES_DIR := $(build)-x-$(target)-holes
163
164SET_NATIVE_HOLES := SHELL=sh ; PATH=`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ;
165SET_CYGNUS_PATH := SHELL=sh ; PATH=`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ;
166SET_LATEST_PATH := SHELL=sh ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ;
167
168else
169
170holesys := $(host)
171HOLESSTAMP := $(holesys)-stamp-holes
172HOLESDIR := $(holesys)-holes
c12d9b4c 173
301482c7
DZ
174SET_NATIVE_HOLES := SHELL=sh ; PATH=`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
175SET_CYGNUS_PATH := SHELL=sh ; PATH=$(relbindir):`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
176SET_LATEST_PATH := SHELL=sh ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
41a88234 177
35eae2d8 178endif
41a88234 179
c12d9b4c 180.PHONY: all
04a59f79 181ifneq ($(target),$(host))
5ba00487
DZ
182##
183## This is a cross compilation
184##
185arch = $(host)-x-$(target)
35eae2d8 186config = -host=$(host) -target=$(target)
5ba00487
DZ
187FLAGS_TO_PASS := $(FLAGS_TO_PASS) "target=$(target)"
188
04a59f79 189ifneq ($(build),$(host))
35eae2d8
ILT
190all: do-cygnus do-latest
191build-all: build-cygnus build-latest
192else
5ba00487
DZ
193all: do-native do-latest
194build-all: build-native build-latest
35eae2d8
ILT
195endif
196
197ifeq ($(target),mips-idt-ecoff)
04a59f79
DZ
198configargs := $(configargs) -with-gnu-as -with-stabs
199endif
200
201ifeq ($(host),i386-go32)
202ifeq ($(subst mips-idt-ecoff,sparclite-aout,$(target)),sparclite-aout)
203configargs := $(configargs) -with-gnu-ld
204endif
35eae2d8 205endif
5ba00487
DZ
206
207else
208##
209## This is a native compilation
210##
301c3fef 211arch = $(host)
35eae2d8 212config = -host=$(host)
04a59f79 213ifneq ($(build),$(host))
35eae2d8
ILT
214all: do-cygnus do-latest
215else
5ba00487 216all: $(host)-stamp-3stage-done
35eae2d8 217endif
5ba00487 218#all: in-place do1 do2 do3 comparison
35eae2d8
ILT
219
220ifeq ($(subst mips-sgi-irix4,mips-dec-ultrix,$(host)),mips-dec-ultrix)
04a59f79 221configargs := $(configargs) -with-gnu-as -with-stabs
35eae2d8
ILT
222endif
223
5ba00487
DZ
224endif
225
04a59f79
DZ
226ifeq ($(target),m68k-hp-hpux)
227configargs := $(configargs) -with-gnu-as
228endif
229
230
301c3fef
DZ
231NATIVEDIR := $(arch)-native-objdir
232CYGNUSDIR := $(arch)-cygnus-objdir
233LATESTDIR := $(arch)-latest-objdir
234
235
5ba00487
DZ
236everything: do-cross
237#everything: in-place do1 do2 do3 comparison do-cygnus
238
239.PHONY: do-native
35eae2d8 240do-native: $(HOLESSTAMP) $(arch)-stamp-native
5ba00487 241do-native-config: $(arch)-stamp-native-configured
35eae2d8
ILT
242build-native: $(HOLESSTAMP) $(arch)-stamp-native-checked
243config-native: $(HOLESSTAMP) $(arch)-stamp-native-configured
5ba00487 244
35eae2d8 245$(arch)-stamp-native: $(HOLESSTAMP)
301482c7 246 $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-native-installed $(FLAGS_TO_PASS)
5ba00487
DZ
247 if [ -f CLEAN_ALL ] ; then rm -rf $(NATIVEDIR) ; else true ; fi
248 touch $(arch)-stamp-native
249
35eae2d8 250$(arch)-stamp-native-installed: $(HOLESSTAMP) $(arch)-stamp-native-checked
301482c7
DZ
251 $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install
252 $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install-info
5ba00487
DZ
253 touch $@
254
255$(arch)-stamp-native-checked: $(arch)-stamp-native-built
256# cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) check
257 touch $@
258
35eae2d8 259$(arch)-stamp-native-built: $(HOLESSTAMP) $(arch)-stamp-native-configured
301482c7
DZ
260 $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) all
261 $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) info
5ba00487
DZ
262 touch $@
263
35eae2d8 264$(arch)-stamp-native-configured: $(HOLESSTAMP)
5ba00487 265 [ -d $(NATIVEDIR) ] || mkdir $(NATIVEDIR)
35eae2d8 266 $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
5ba00487
DZ
267 touch $@
268
269
270.PHONY: do-cygnus
35eae2d8
ILT
271do-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus
272build-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-checked
273config-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-configured
5ba00487 274
04a59f79
DZ
275vault-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-built
276 $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) vault-install
277
278
5ba00487 279$(arch)-stamp-cygnus:
04a59f79 280 [ -f $(relbindir)/$(host)-gcc ] || (echo "must have gcc available"; exit 1)
41a88234 281 $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-cygnus-installed $(FLAGS_TO_PASS)
5ba00487
DZ
282 if [ -f CLEAN_ALL ] ; then rm -rf $(CYGNUSDIR) ; else true ; fi
283 touch $(arch)-stamp-cygnus
284
35eae2d8 285$(arch)-stamp-cygnus-installed: $(HOLESSTAMP) $(arch)-stamp-cygnus-checked
41a88234
ILT
286 $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install
287 $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info
5ba00487
DZ
288 touch $@
289
35eae2d8 290$(arch)-stamp-cygnus-checked: $(HOLESSTAMP) $(arch)-stamp-cygnus-built
5ba00487
DZ
291# cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check
292 touch $@
293
35eae2d8 294$(arch)-stamp-cygnus-built: $(HOLESSTAMP) $(arch)-stamp-cygnus-configured
41a88234
ILT
295 $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all
296 $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info
5ba00487
DZ
297 touch $@
298
35eae2d8 299$(arch)-stamp-cygnus-configured: $(HOLESSTAMP)
5ba00487 300 [ -d $(CYGNUSDIR) ] || mkdir $(CYGNUSDIR)
35eae2d8 301 $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(GNUC) $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
5ba00487
DZ
302 touch $@
303
304.PHONY: do-latest
35eae2d8
ILT
305do-latest: $(HOLESSTAMP) $(arch)-stamp-latest
306build-latest: $(HOLESSTAMP) $(arch)-stamp-latest-checked
5ba00487
DZ
307
308$(arch)-stamp-latest:
41a88234 309 $(SET_LATEST_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-latest-installed $(FLAGS_TO_PASS)
5ba00487
DZ
310 touch $(arch)-stamp-latest
311
35eae2d8 312$(arch)-stamp-latest-installed: $(HOLESSTAMP) $(arch)-stamp-latest-checked
41a88234
ILT
313 $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install
314 $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info
5ba00487
DZ
315 touch $@
316
317$(arch)-stamp-latest-checked: $(arch)-stamp-latest-built
41a88234 318# $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check
5ba00487
DZ
319 touch $@
320
321$(arch)-stamp-latest-built: $(arch)-stamp-latest-configured
41a88234
ILT
322 $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all
323 $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info
5ba00487
DZ
324 touch $@
325
326$(arch)-stamp-latest-configured:
327 [ -d $(LATESTDIR) ] || mkdir $(LATESTDIR)
35eae2d8 328 $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(GNUC) $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
5ba00487
DZ
329 touch $@
330
7bea9148
RP
331
332.PHONY: in-place
333in-place: $(host)-stamp-in-place
334
5ba00487 335$(host)-stamp-in-place:
7bea9148 336 PATH=/bin:/usr/bin:/usr/ucb ; \
5ba00487
DZ
337 export PATH ; \
338 SHELL=/bin/sh ; export SHELL ; \
339 $(TIME) $(GNU_MAKE) -f test-build.mk $(host)-stamp-in-place-installed host=$(host) $(FLAGS_TO_PASS)
7bea9148 340 touch $@
5ba00487
DZ
341 if [ -f CLEAN_ALL ] ; then \
342 rm -rf $(INPLACEDIR) ; \
343 else \
344 mv $(INPLACEDIR) $(STAGE1DIR) ; \
345 fi
7bea9148
RP
346
347$(host)-stamp-in-place-installed: $(host)-stamp-in-place-checked
41a88234
ILT
348 cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host)
349 cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host)
7bea9148
RP
350 touch $@
351
352$(host)-stamp-in-place-checked: $(host)-stamp-in-place-built
41a88234 353# cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host)
7bea9148
RP
354 touch $@
355
356$(host)-stamp-in-place-built: $(host)-stamp-in-place-configured
41a88234
ILT
357 cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host)
358 cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host)
7bea9148
RP
359 touch $@
360
361$(host)-stamp-in-place-configured: $(host)-stamp-in-place-cp
35eae2d8 362 cd $(INPLACEDIR) ; $(configenv) $(TIME) ./configure $(config) -v $(prefixes) $(configargs)
7bea9148
RP
363 touch $@
364
365$(host)-stamp-in-place-cp:
366 rm -rf $(INPLACEDIR)
367 mkdir $(INPLACEDIR)
368 (cd $(TREE) ; tar cf - .) | (cd $(INPLACEDIR) ; tar xf -)
369 touch $@
c12d9b4c 370
5ba00487
DZ
371$(host)-stamp-3stage-done: do1 do2 do3 comparison
372 touch $@
373
374
c12d9b4c 375.PHONY: do1
35eae2d8
ILT
376do1: $(HOLESSTAMP) $(host)-stamp-stage1
377do1-config: $(HOLESSTAMP) $(host)-stamp-stage1-configured
378do1-build: $(HOLESSTAMP) $(host)-stamp-stage1-checked
c12d9b4c 379
04a59f79
DZ
380do1-vault: $(HOLESSTAMP) $(host)-stamp-stage1-built
381 if [ -d $(WORKING_DIR).1 ] ; then \
382 $(SET_NATIVE_HOLES) cd $(WORKING_DIR).1 ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
383 else \
384 $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
385 fi
386
c12d9b4c
RP
387$(host)-stamp-stage1:
388 if [ -d $(STAGE1DIR) ] ; then \
389 mv $(STAGE1DIR) $(WORKING_DIR) ; \
390 else \
391 true ; \
392 fi
301482c7 393 $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) $(host)-stamp-stage1-installed
7bea9148 394 touch $@
5ba00487
DZ
395 if [ -f CLEAN_ALL ] ; then \
396 rm -rf $(WORKING_DIR) ; \
397 else \
398 mv $(WORKING_DIR) $(STAGE1DIR) ; \
399 fi
c12d9b4c
RP
400
401$(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked
301482c7
DZ
402 $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host)
403 $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host)
fdfa2371 404ifeq ($(host),rs6000-ibm-aix)
35eae2d8 405 -rm $(relbindir)/make
fdfa2371 406endif
c12d9b4c
RP
407 touch $@
408
409$(host)-stamp-stage1-checked: $(host)-stamp-stage1-built
301482c7 410# $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host)
c12d9b4c
RP
411 touch $@
412
413$(host)-stamp-stage1-built: $(host)-stamp-stage1-configured
301482c7
DZ
414 $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host)
415 $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host)
c12d9b4c
RP
416 touch $@
417
418$(host)-stamp-stage1-configured:
419 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
301482c7 420 $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; \
35eae2d8 421 $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
c12d9b4c
RP
422 touch $@
423
424.PHONY: do2
425do2: $(HOLESDIR) $(host)-stamp-stage2
426
04a59f79
DZ
427do2-vault: $(HOLESSTAMP) $(host)-stamp-stage2-built
428 if [ -d $(WORKING_DIR).2 ] ; then \
429 $(SET_CYGNUS_PATH) cd $(WORKING_DIR).2 ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
430 else \
431 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
432 fi
433
434
435
c12d9b4c
RP
436$(host)-stamp-stage2:
437 if [ -d $(STAGE2DIR) ] ; then \
438 mv $(STAGE2DIR) $(WORKING_DIR) ; \
439 else \
440 true ; \
441 fi
41a88234 442 $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage2-installed
5ba00487 443 mv $(WORKING_DIR) $(STAGE2DIR)
7bea9148 444 touch $@
c12d9b4c 445
c12d9b4c
RP
446
447$(host)-stamp-stage2-installed: $(host)-stamp-stage2-checked
41a88234
ILT
448 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host)
449 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host)
c12d9b4c
RP
450 touch $@
451
452$(host)-stamp-stage2-checked: $(host)-stamp-stage2-built
41a88234 453# $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host)
c12d9b4c
RP
454 touch $@
455
456$(host)-stamp-stage2-built: $(host)-stamp-stage2-configured
41a88234
ILT
457 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host)
458 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host)
c12d9b4c
RP
459 touch $@
460
461$(host)-stamp-stage2-configured:
462 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
41a88234 463 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
35eae2d8 464 $(configenv) $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
c12d9b4c
RP
465 touch $@
466
467.PHONY: do3
468do3: $(HOLESDIR) $(host)-stamp-stage3
469
04a59f79
DZ
470do3-vault: $(HOLESSTAMP) $(host)-stamp-stage3-built
471 if [ -d $(WORKING_DIR).3 ] ; then \
472 $(SET_CYGNUS_PATH) cd $(WORKING_DIR).3 ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
473 else \
474 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
475 fi
476
c12d9b4c 477$(host)-stamp-stage3:
5ba00487
DZ
478 if [ -d $(STAGE3DIR) ] ; then \
479 mv $(STAGE3DIR) $(WORKING_DIR) ; \
c12d9b4c
RP
480 else \
481 true ; \
482 fi
41a88234 483 $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage3-checked
5ba00487 484 mv $(WORKING_DIR) $(STAGE3DIR)
7bea9148 485 touch $@
c12d9b4c 486
c12d9b4c
RP
487
488$(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked
41a88234
ILT
489 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host)
490 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host)
c12d9b4c
RP
491 touch $@
492
493$(host)-stamp-stage3-checked: $(host)-stamp-stage3-built
41a88234 494# $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host)
c12d9b4c
RP
495 touch $@
496
497$(host)-stamp-stage3-built: $(host)-stamp-stage3-configured
41a88234
ILT
498 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host)
499 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host)
c12d9b4c
RP
500 touch $@
501
502$(host)-stamp-stage3-configured:
503 [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
41a88234 504 $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
35eae2d8 505 $(configenv) $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
c12d9b4c
RP
506 touch $@
507
508# These things are needed by a three-stage, but are not included locally.
509
510HOLES := \
511 [ \
512 ar \
513 as \
514 awk \
515 basename \
516 cat \
517 cc \
518 chmod \
04a59f79
DZ
519 chgrp \
520 chown \
c12d9b4c
RP
521 cmp \
522 cp \
41a88234 523 cpio \
c12d9b4c
RP
524 date \
525 diff \
04a59f79 526 dirname \
c12d9b4c
RP
527 echo \
528 egrep \
529 ex \
530 expr \
301482c7 531 false \
c12d9b4c
RP
532 find \
533 grep \
5ba00487 534 head \
c12d9b4c
RP
535 hostname \
536 install \
537 ld \
538 lex \
539 ln \
540 ls \
541 make \
542 mkdir \
543 mv \
544 nm \
545 pwd \
546 ranlib \
547 rm \
548 rmdir \
549 sed \
550 sh \
551 sort \
41a88234 552 tar \
c12d9b4c
RP
553 test \
554 time \
555 touch \
556 tr \
557 true \
35eae2d8 558 uname \
04a59f79 559 uniq \
41a88234 560 uudecode \
40a75cc7 561 wc \
c12d9b4c
RP
562 whoami
563
564### so far only sun make supports VPATH
35eae2d8 565ifeq ($(subst sun3,sun4,$(holesys)),sun4)
c12d9b4c
RP
566MAKE_HOLE :=
567else
568MAKE_HOLE := make
569endif
570
5ba00487 571### solaris 2 -- don't use /usr/ucb/cc
35eae2d8 572ifeq (sparc-sun-solaris2,$(holesys))
301482c7 573SET_NATIVE_HOLES := SHELL=sh ; PATH=/opt/SUNWspro/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
af5874bd 574HOLE_DIRS := /usr/ccs/bin
301c3fef
DZ
575CC_HOLE :=
576NUKEM := cc
5ba00487
DZ
577endif
578
c12d9b4c
RP
579### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required.
580PARTIAL_HOLES := \
c12d9b4c 581 $(MAKE_HOLE) \
5ba00487 582 $(CC_HOLE) \
c12d9b4c
RP
583 flex \
584 m4
585
586### look in these directories for things missing from a three-stage
587HOLE_DIRS := \
fdfa2371 588 $(HOLE_DIRS) \
c12d9b4c
RP
589 /bin \
590 /usr/bin \
591 /usr/ucb \
592 /usr/unsupported/bin
593
594### look in these directories for alternate versions of some tools.
595PARTIAL_HOLE_DIRS := \
596 /usr/latest/bin \
597 /usr/progressive/bin \
fdfa2371 598 $(PARTIAL_HOLE_DIRS) \
c12d9b4c
RP
599 /usr/vintage/bin \
600 /usr/unsupported/bin
601
35eae2d8 602$(HOLESDIR): $(holesys)-stamp-holes
c12d9b4c 603
35eae2d8 604$(holesys)-stamp-holes:
c12d9b4c
RP
605 -rm -rf $(HOLESDIR)
606 -mkdir $(HOLESDIR)
5ba00487 607 @for i in $(HOLES) ; do \
c12d9b4c
RP
608 found= ; \
609 for j in $(HOLE_DIRS) ; do \
610 if [ -x $$j/$$i ] ; then \
21412832 611 ln -s $$j/$$i $(HOLESDIR) || cp $$j/$$i $(HOLESDIR) ; \
c12d9b4c
RP
612 echo $$i from $$j ; \
613 found=t ; \
614 break ; \
615 fi ; \
616 done ; \
617 case "$$found" in \
618 t) ;; \
619 *) echo $$i is NOT found ;; \
620 esac ; \
621 done
5ba00487 622 @for i in $(PARTIAL_HOLES) ; do \
c12d9b4c
RP
623 found= ; \
624 for j in $(PARTIAL_HOLE_DIRS) ; do \
625 if [ -x $$j/$$i ] ; then \
626 rm -f $(HOLESDIR)/$$i ; \
627 cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \
628 echo $$i from $$j ; \
629 found=t ; \
630 break ; \
631 fi ; \
632 done ; \
633 case "$$found" in \
634 t) ;; \
635 *) echo $$i is NOT found ;; \
636 esac ; \
637 done
301c3fef
DZ
638ifdef NUKEM
639 cd $(HOLESDIR); rm -f $(NUKEM)
640endif
7bea9148 641 touch $@
c12d9b4c 642
35eae2d8
ILT
643# Get the cross-tools for build cross host when not building on the host.
644
645BUILD_HOST_HOLES := \
646 byacc \
647 gcc \
648 makeinfo \
649 $(AR) \
650 $(AS) \
651 $(CC) \
652 $(CXX) \
653 $(GXX) \
654 $(NM) \
655 $(RANLIB)
656
04a59f79 657BUILD_HOLES_DIRS := $(release_root)/H-$(build)/bin $(PARTIAL_HOLE_DIRS)
35eae2d8 658
7f0d689a 659ifdef BUILD_HOST_HOLES_DIR
35eae2d8 660$(BUILD_HOST_HOLES_DIR): $(build)-x-$(host)-stamp-holes
7f0d689a 661endif
35eae2d8 662
04a59f79 663ifneq ($(build),$(host))
35eae2d8
ILT
664$(build)-x-$(host)-stamp-holes:
665 -rm -rf $(BUILD_HOST_HOLES_DIR)
666 -mkdir $(BUILD_HOST_HOLES_DIR)
667 @for i in $(BUILD_HOST_HOLES) ; do \
668 found= ; \
669 for j in $(BUILD_HOLES_DIRS) ; do \
670 if [ -x $$j/$$i ] ; then \
671 ln -s $$j/$$i $(BUILD_HOST_HOLES_DIR) || cp $$j/$$i $(BUILD_HOST_HOLES_DIR) ; \
672 echo $$i from $$j ; \
673 found=t ; \
674 break ; \
675 fi ; \
676 done ; \
677 case "$$found" in \
678 t) ;; \
679 *) echo $$i is NOT found ;; \
680 esac ; \
681 done
682 touch $@
04a59f79 683endif
35eae2d8
ILT
684
685# Get the cross tools for build cross target when not building on the host.
686
687BUILD_TARGET_HOLES := \
688 byacc \
689 gcc \
690 makeinfo \
691 $(AR_FOR_TARGET) \
692 $(AS_FOR_TARGET) \
693 $(CC_FOR_TARGET) \
694 $(CXX_FOR_TARGET) \
695 $(GXX_FOR_TARGET) \
696 $(NM_FOR_TARGET) \
697 $(RANLIB_FOR_TARGET)
698
7f0d689a 699ifdef BUILD_TARGET_HOLES_DIR
35eae2d8 700$(BUILD_TARGET_HOLES_DIR): $(build)-x-$(target)-stamp-holes
7f0d689a 701endif
35eae2d8 702
04a59f79 703ifneq ($(build),$(target))
35eae2d8
ILT
704$(build)-x-$(target)-stamp-holes:
705 -rm -rf $(BUILD_TARGET_HOLES_DIR)
706 -mkdir $(BUILD_TARGET_HOLES_DIR)
707 @for i in $(BUILD_TARGET_HOLES) ; do \
708 found= ; \
709 for j in $(BUILD_HOLES_DIRS) ; do \
710 if [ -x $$j/$$i ] ; then \
711 ln -s $$j/$$i $(BUILD_TARGET_HOLES_DIR) || cp $$j/$$i $(BUILD_TARGET_HOLES_DIR) ; \
712 echo $$i from $$j ; \
713 found=t ; \
714 break ; \
715 fi ; \
716 done ; \
717 case "$$found" in \
718 t) ;; \
719 *) echo $$i is NOT found ;; \
720 esac ; \
721 done
722 touch $@
04a59f79 723endif
35eae2d8 724
c12d9b4c 725.PHONY: comparison
5ba00487
DZ
726comparison: $(host)-stamp-3stage-compared
727
728$(host)-stamp-3stage-compared:
729 rm -f .bad-compare
21412832 730ifeq ($(subst i386-sco3.2v4,mips-sgi-irix4,$(subst rs6000-ibm-aix,mips-sgi-irix4,$(subst mips-dec-ultrix,mips-sgi-irix4,$(host)))),mips-sgi-irix4)
5ba00487
DZ
731 for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
732 tail +10c $(STAGE2DIR)/$$i > foo1 ; \
733 tail +10c $(STAGE3DIR)/$$i > foo2 ; \
734 if cmp foo1 foo2 ; then \
735 true ; \
736 else \
737 echo $$i ; \
738 touch .bad-compare ; \
739 fi ; \
740 done
741 rm -f foo1 foo2
c12d9b4c 742else
5ba00487
DZ
743 for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
744 cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i || touch .bad-compare ; \
745 done
746endif
747 if [ -f CLEAN_ALL ] ; then \
748 rm -rf $(STAGE2DIR) $(STAGE3DIR) ; \
dae8a4cf 749 else \
5ba00487
DZ
750 if [ -f CLEAN_STAGES ] ; then \
751 if [ -f .bad-compare ] ; then \
752 true ; \
753 else \
754 rm -rf $(STAGE1DIR) $(STAGE2DIR) ; \
755 fi ; \
21412832 756 else true ; \
5ba00487 757 fi ; \
dae8a4cf 758 fi
5ba00487 759 touch $@
c12d9b4c
RP
760
761.PHONY: clean
762clean:
7bea9148 763 rm -rf $(HOLESDIR) $(INPLACEDIR) $(WORKING_DIR)* $(host)-stamp-* *~
c12d9b4c
RP
764
765.PHONY: very
766very:
7bea9148 767 rm -rf $(TREE)
c12d9b4c
RP
768
769force:
770
771endif # host
772
773### Local Variables:
774### fill-column: 131
775### End:
This page took 0.129461 seconds and 4 git commands to generate.