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