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