add support for i386-unixware target, m68k-vxworks5.1 target, i960-vxworks5.1 target...
[external/binutils.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 ### from which cvs tree are we working?
31 TREE := devo
32
33 include $(TREE)/release-info
34
35 # Set TIME to time to get timings.  Not done by default because time
36 # ignores the exit status.
37 TIME            :=
38
39 CONFIG_SHELL    := 
40 GCC             := $(host)-gcc
41 GNUCFLAGS       := -g -O2
42 GNUC            := CC="$(GCC)" CFLAGS="$(GNUCFLAGS)"
43 CFLAGS          := -g
44 CXXFLAGS        := -g -O2
45 GNU_MAKE        := /usr/latest/bin/make -w 
46 MAKEINFOFLAGS   :=
47
48 override MAKE           := make -w
49 override MFLAGS         :=
50 #override MAKEFLAGS     :=
51
52 SHELL := /bin/sh
53
54 ifndef build
55 build := $(host)
56 endif
57
58 ifndef target
59 target := $(host)
60 endif
61
62 ifeq ($(patsubst %-lynx,lynx,$(host)),lynx)
63 SHELL := /bin/bash
64 GNU_MAKE := $(MAKE)
65 CONFIG_SHELL    := /bin/bash
66 endif
67
68 ifeq ($(patsubst %-m68k-hp-hpux,m68k-hp-hpux,$(host)),m68k-hp-hpux)
69 SHELL := /usr/unsupported/bin/bash
70 GNU_MAKE := $(MAKE)
71 CONFIG_SHELL    := /usr/unsupported/bin/bash
72 endif
73
74 ifneq ($(build),$(host))
75
76 # We are building on a machine other than the host.  We rely upon
77 # previously built cross-compilers from the build machine to the host
78 # (used to build the executables) and from the build machine to the
79 # target (used to build the libraries).
80
81 AR              := $(host)-ar
82 AR_FOR_TARGET   := $(target)-ar
83 AS              := $(host)-as
84 AS_FOR_TARGET   := $(target)-as
85 BISON           := byacc
86 CC              := $(host)-gcc
87 CC_FOR_BUILD    := gcc
88 CC_FOR_TARGET   := $(target)-gcc
89 CFLAGS          := $(GNUCFLAGS)
90 CXX             := $(host)-gcc 
91 CXX_FOR_TARGET  := $(target)-gcc
92 GCC             := $(host)-gcc
93 GXX             := $(host)-g++
94 GXX_FOR_TARGET  := $(target)-g++
95 HOST_PREFIX     := $(build)-
96 HOST_PREFIX_1   := $(build)-
97 LEX             := flex
98 MAKEINFO        := makeinfo
99 MUNCH_NM        := $(host)-nm
100 NM              := $(host)-nm
101 NM_FOR_TARGET   := $(target)-nm
102 RANLIB          := $(host)-ranlib
103 RANLIB_FOR_TARGET       := $(target)-ranlib
104 YACC            := $(BISON)
105
106 ifeq ($(host),i386-go32)
107 MAKEINFOFLAGS = --no-split
108 endif
109
110 FLAGS_TO_PASS := \
111         "AR=$(AR)" \
112         "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
113         "AS=$(AS)" \
114         "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
115         "BISON=$(BISON)" \
116         "CC=$(CC)" \
117         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
118         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
119         "CXX=$(CXX)" \
120         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
121         "CFLAGS=$(CFLAGS)" \
122         "CXXFLAGS=$(CXXFLAGS)" \
123         "GCC=$(GCC)" \
124         "HOST_PREFIX=$(HOST_PREFIX)" \
125         "HOST_PREFIX_1=$(HOST_PREFIX_1)" \
126         "LEX=$(LEX)" \
127         "MAKEINFO=$(MAKEINFO)" \
128         "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
129         "MF=$(MF)" \
130         "MUNCH_NM=$(MUNCH_NM)" \
131         "NM=$(NM)" \
132         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
133         "RANLIB=$(RANLIB)" \
134         "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
135         "RELEASE_TAG=$(RELEASE_TAG)" \
136         "RUNTEST=$(relbindir)/runtest" \
137         "SHELL=$(SHELL)" \
138         "TIME=$(TIME)" \
139         "YACC=$(YACC)" \
140         "build=$(build)" \
141         "host=$(host)"
142
143 # We must pass the build cross host tools in the environment of
144 # configure, so that autoconf scripts will run the right programs.
145 configenv := AR="$(AR)" CC="$(CC)" RANLIB="$(RANLIB)"
146
147 else
148
149 # This is a normal build on the host machine.
150
151 FLAGS_TO_PASS := \
152         "GCC=$(GCC)" \
153         "CFLAGS=$(CFLAGS)" \
154         "CXXFLAGS=$(CXXFLAGS)" \
155         "TIME=$(TIME)" \
156         "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
157         "MF=$(MF)" \
158         "host=$(host)" \
159         "RELEASE_TAG=$(RELEASE_TAG)" \
160         "SHELL=$(SHELL)" 
161
162 configenv :=
163
164 endif
165
166 #### we need to change the default C compiler for some hosts
167 ifeq ($(host),sparc-sun-solaris2)
168 CC := cc -Xs
169 endif
170
171 ifeq ($(host),mips-sgi-irix4)
172 CC := cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000
173 endif
174
175 ifeq ($(host),hppa1.1-hp-hpux)
176 CC := cc -Wp,-H256000
177 endif
178
179 ifeq ($(host),m68k-hp-hpux)
180 CC := cc -Wp,-P,-H256000
181 endif
182
183 ifeq ($(host),mips-mips-riscos5sysv)
184 CC := cc -non_shared -systype sysv
185 endif
186
187 ifeq ($(host),mips-dec-ultrix)
188 CC := cc -Wf,-XNg1000
189 endif
190
191 ifeq ($(host),m68k-sun-sunos4.1.1)
192 CC := cc -J
193 endif
194
195 # Support gdbtk everywhere
196 configargs = --enable-gdbtk
197
198 # We want to use stabs for MIPS targets.
199 ifeq ($(target),mips-idt-ecoff)
200 configargs := $(configargs) --with-stabs
201 endif
202
203 ifeq ($(target),mips-dec-ultrix)
204 configargs := $(configargs) --with-stabs
205 endif
206
207 ifeq ($(target),mips-sgi-irix4)
208 configargs := $(configargs) --with-stabs
209 endif
210
211 ifeq ($(target),mips-sgi-irix5)
212 configargs := $(configargs) --with-stabs
213 endif
214
215 ifeq ($(patsubst alpha-dec-osf%,alpha,$(target)),alpha)
216 configargs := $(configargs) --with-stabs
217 endif
218
219 # We must use stabs for SVR4 targets.
220 ifeq ($(target),i386-sysv4.2)
221 configargs := $(configargs) --with-stabs
222 endif
223
224 ifneq ($(CC), 'cc')
225 FLAGS_TO_PASS := "CC=$(CC)" $(FLAGS_TO_PASS)
226 endif
227
228 #### and on some, we need CONFIG_SHELL
229 ifeq ($(patsubst %-lynxos,lynxos,$(host)),lynxos)
230 FLAGS_TO_PASS := "CONFIG_SHELL=$(CONFIG_SHELL)" $(FLAGS_TO_PASS)
231 endif
232
233 # These are the prefixes used for Cygnus builds.
234 prefixes        = --prefix=$(release_root) --exec-prefix=$(release_root)/H-$(host)
235
236 relbindir       = $(release_root)/H-$(build)/bin
237
238 ### general config stuff
239 WORKING_DIR     := $(host)-objdir
240 STAGE1DIR       := $(WORKING_DIR).1
241 STAGE2DIR       := $(WORKING_DIR).2
242 STAGE3DIR       := $(WORKING_DIR).3
243 STAGE4DIR       := $(WORKING_DIR).4
244 INPLACEDIR      := $(host)-in-place
245
246 # Arrange to find the needed programs.  If we are building on a
247 # machine other than the host, we must find the cross-compilers.
248
249 ifneq ($(build),$(host))
250
251 holesys         := $(build)
252 HOLESSTAMP      := $(holesys)-stamp-holes $(build)-x-$(host)-stamp-holes $(build)-x-$(target)-stamp-holes
253 HOLESDIR        := $(holesys)-holes
254 BUILD_HOST_HOLES_DIR    := $(build)-x-$(host)-holes
255 BUILD_TARGET_HOLES_DIR  := $(build)-x-$(target)-holes
256
257 SET_NATIVE_HOLES := SHELL=$(SHELL) ; PATH=`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ;
258 SET_CYGNUS_PATH  := SHELL=$(SHELL) ; PATH=`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ;
259 SET_LATEST_PATH  := SHELL=$(SHELL) ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ;
260
261 else
262
263 holesys         := $(host)
264 HOLESSTAMP      := $(holesys)-stamp-holes
265 HOLESDIR        := $(holesys)-holes
266
267 SET_NATIVE_HOLES := SHELL=$(SHELL) ; PATH=`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
268 SET_CYGNUS_PATH  := SHELL=$(SHELL) ; PATH=$(relbindir):`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
269 SET_LATEST_PATH  := SHELL=$(SHELL) ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
270
271 endif
272
273 .PHONY: all
274 ifneq ($(target),$(host))
275 ##
276 ## This is a cross compilation
277 ##
278 arch            = $(host)-x-$(target)
279 config          = -host=$(host) -target=$(target)
280 FLAGS_TO_PASS   := $(FLAGS_TO_PASS) "target=$(target)"
281
282 ifeq ($(patsubst %-lynx,lynx,$(target)),lynx)
283 configargs := $(configargs) --with-headers=/s1/cygnus/dejagnu/$(target)/include \
284                 --with-libs=/s1/cygnus/dejagnu/$(target)/lib
285 endif
286
287 ifeq ($(patsubst %-i386-sysv4.2,i386-sysv4.2,$(target)),i386-sysv4.2)
288 configargs := $(configargs) --with-headers=/s1/cygnus/dejagnu/$(target)/include \
289                 --with-libs=/s1/cygnus/dejagnu/$(target)/lib
290 endif
291
292 ifeq ($(patsubst %-i386-netware,i386-netware,$(target)),i386-netware)
293 configargs := $(configargs) \
294         --with-headers=/s1/cygnus/dejagnu/$(target)/include \
295         --with-libs=/s1/cygnus/dejagnu/$(target)/lib
296 endif
297
298 ifeq ($(patsubst %-sparc-sun-sunos4.1.3,sparc-sun-sunos4.1.3,$(target)),sparc-sun-sunos4.1.3)
299 configargs := $(configargs) \
300         --with-headers=/s1/cygnus/dejagnu/$(target)/include \
301         --with-libs=/s1/cygnus/dejagnu/$(target)/lib
302 endif
303
304 ifeq ($(patsubst %-sparc-sun-solaris2,sparc-sun-solaris2,$(target)),sparc-sun-solaris2)
305 configargs := $(configargs) \
306         --with-headers=/s1/cygnus/dejagnu/$(target)/include \
307         --with-libs=/s1/cygnus/dejagnu/$(target)/lib
308 endif
309
310 ifeq ($(patsubst %-i960-vxworks5.1,i960-vxworks5.1,$(target)),i960-vxworks5.1)
311 configargs := $(configargs) \
312         --with-headers=/s1/cygnus/dejagnu/$(target)/include
313 endif
314
315 ifeq ($(patsubst %-m68k-vxworks5.1,m68k-vxworks5.1,$(target)),m68k-vxworks5.1)
316 configargs := $(configargs) \
317         --with-headers=/s1/cygnus/dejagnu/$(target)/include
318 endif
319
320 ifeq ($(patsubst %-i386-unixware,i386-unixware,$(target)),i386-unixware)
321 configargs := $(configargs) \
322         --with-headers=/s1/cygnus/dejagnu/$(target)/include \
323         --with-libs=/s1/cygnus/dejagnu/$(target)/lib
324 endif
325
326 ifneq ($(build),$(host))
327 all:    do-cygnus do-latest
328 build-all: build-cygnus build-latest
329 else
330 all:    do-native do-latest
331 build-all: build-native build-latest
332 endif
333
334
335 else
336 ##
337 ## This is a native compilation
338 ##
339 arch            = $(host)
340 config          = -host=$(host)
341 ifneq ($(build),$(host))
342 all:    do-cygnus do-latest
343 else
344 all:    $(host)-stamp-3stage-done
345 endif
346 #all:   in-place do1 do2 do3 comparison
347
348 endif
349
350 NATIVEDIR       := $(arch)-native-objdir
351 CYGNUSDIR       := $(arch)-cygnus-objdir
352 LATESTDIR       := $(arch)-latest-objdir
353 DOSDIR          := dos-x-$(target)-objdir
354
355 everything:      do-cross 
356 #everything:    in-place do1 do2 do3 comparison do-cygnus 
357
358 .PHONY: dos
359 dos:
360         $(MAKE) -f test-build.mk CFLAGS= build=$(host) host=i386-go32 target=$(target) do-dos
361 dos-path:
362         $(MAKE) -f test-build.mk CFLAGS= build=$(host) host=i386-go32 target=$(target) path-dos
363
364 .PHONY: do-dos
365 do-dos: $(HOLESSTAMP) dos-x-$(target)-stamp-done
366 build-dos: $(HOLESSTAMP) dos-x-$(target)-stamp-dos-checked
367 config-dos: $(HOLESSTAMP) dos-x-$(target)-stamp-dos-configured
368 path-dos:
369         @echo "$(SET_CYGNUS_PATH)"
370
371 dos-x-$(target)-stamp-done: 
372         [ -f $(relbindir)/$(host)-gcc ] || (echo "must have gcc available"; exit 1)
373         $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk dos-x-$(target)-stamp-installed  $(FLAGS_TO_PASS)
374         if [ -f CLEAN_ALL -o -f CLEAN_CROSSES ] ; then rm -rf $(DOSDIR) ; else true ; fi
375         touch $@
376
377 dos-x-$(target)-stamp-installed: $(HOLESSTAMP) dos-x-$(target)-stamp-intermediate
378         [ -d dos-x-$(target)-installed ] || mkdir dos-x-$(target)-installed
379         $(SET_CYGNUS_PATH) $(TREE)/release/mkdosrel dos-x-$(target)-intermediate \
380           dos-x-$(target)-installed $(target)
381 #       (cd dos-x-$(target)-installed; find . -print | $(TREE)/release/make8.3)
382         touch $@
383
384 dos-x-$(target)-stamp-intermediate:  $(HOLESSTAMP) dos-x-$(target)-stamp-dos-checked
385         [ -d dos-x-$(target)-intermediate ] || mkdir dos-x-$(target)-intermediate
386         dir=`pwd` ; export dir ; \
387         $(SET_CYGNUS_PATH) cd $(DOSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) \
388           prefix=$$dir/dos-x-$(target)-intermediate install install-info 
389         touch $@
390
391 dos-x-$(target)-stamp-dos-checked: $(HOLESSTAMP) dos-x-$(target)-stamp-dos-built
392 #       cd $(DOSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check 
393         touch $@
394
395 dos-x-$(target)-stamp-dos-built:  $(HOLESSTAMP) dos-x-$(target)-stamp-dos-configured
396         $(SET_CYGNUS_PATH) cd $(DOSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all info
397         touch $@
398
399 dos-x-$(target)-stamp-dos-configured:  $(HOLESSTAMP)
400         [ -d $(DOSDIR) ] || mkdir $(DOSDIR)
401         $(SET_CYGNUS_PATH) cd $(DOSDIR) ; $(GNUC) $(configenv) $(TIME) $(CONFIG_SHELL) \
402           ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) --prefix=/cygnus \
403           --program-transform-name='' $(configargs)
404         touch $@
405
406
407
408
409 .PHONY: do-native
410 do-native: $(HOLESSTAMP) $(arch)-stamp-native
411 do-native-config: $(arch)-stamp-native-configured
412 build-native: $(HOLESSTAMP) $(arch)-stamp-native-checked
413 config-native: $(HOLESSTAMP) $(arch)-stamp-native-configured
414
415 $(arch)-stamp-native: $(HOLESSTAMP)
416         $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk  $(arch)-stamp-native-installed $(FLAGS_TO_PASS) 
417         if [ -f CLEAN_ALL -o -f CLEAN_CROSSES ] ; then rm -rf $(NATIVEDIR) ; else true ; fi
418         touch $(arch)-stamp-native
419
420 $(arch)-stamp-native-installed: $(HOLESSTAMP) $(arch)-stamp-native-checked
421         $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install 
422         $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install-info 
423         touch $@
424
425 $(arch)-stamp-native-checked: $(arch)-stamp-native-built
426 #       cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) check 
427         touch $@
428
429 $(arch)-stamp-native-built: $(HOLESSTAMP) $(arch)-stamp-native-configured
430         $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) all 
431         $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) info 
432         touch $@
433
434 $(arch)-stamp-native-configured: $(HOLESSTAMP)
435         [ -d $(NATIVEDIR) ] || mkdir $(NATIVEDIR)
436         $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(configenv) CC="$(CC)" $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
437         touch $@
438
439
440 .PHONY: do-cygnus
441 do-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus
442 build-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-checked
443 config-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-configured
444 path-cygnus:
445         $(SET_CYGNUS_PATH) echo $$PATH
446
447 vault-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-built
448         $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) vault-install 
449         
450
451 $(arch)-stamp-cygnus: 
452         [ -f $(relbindir)/$(host)-gcc ] || (echo "must have gcc available"; exit 1)
453         $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-cygnus-installed  $(FLAGS_TO_PASS)
454         if [ -f CLEAN_ALL -o -f CLEAN_CROSSES ] ; then rm -rf $(CYGNUSDIR) ; else true ; fi
455         touch $(arch)-stamp-cygnus
456
457 $(arch)-stamp-cygnus-installed:  $(HOLESSTAMP) $(arch)-stamp-cygnus-checked
458         $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install 
459         $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info
460         if [ -f VAULT-INSTALL ] ; then \
461           $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(MAKE) $(FLAGS_TO_PASS) $(GNUC) vault-install ; \
462         else true ; fi
463         touch $@
464
465 $(arch)-stamp-cygnus-checked: $(HOLESSTAMP) $(arch)-stamp-cygnus-built
466 #       cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check 
467         touch $@
468
469 $(arch)-stamp-cygnus-built:  $(HOLESSTAMP) $(arch)-stamp-cygnus-configured
470         $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all 
471         $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info 
472         touch $@
473
474 $(arch)-stamp-cygnus-configured:  $(HOLESSTAMP)
475         [ -d $(CYGNUSDIR) ] || mkdir $(CYGNUSDIR)
476         $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(configenv) $(GNUC) $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
477         touch $@
478
479 .PHONY: do-latest
480 do-latest: $(HOLESSTAMP) $(arch)-stamp-latest
481 build-latest: $(HOLESSTAMP) $(arch)-stamp-latest-checked
482
483 $(arch)-stamp-latest:
484         $(SET_LATEST_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-latest-installed  $(FLAGS_TO_PASS)
485         touch $(arch)-stamp-latest
486
487 $(arch)-stamp-latest-installed:  $(HOLESSTAMP) $(arch)-stamp-latest-checked
488         $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install 
489         $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info 
490         touch $@
491
492 $(arch)-stamp-latest-checked: $(arch)-stamp-latest-built
493 #       $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check 
494         touch $@
495
496 $(arch)-stamp-latest-built: $(arch)-stamp-latest-configured
497         $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all 
498         $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info 
499         touch $@
500
501 $(arch)-stamp-latest-configured:
502         [ -d $(LATESTDIR) ] || mkdir $(LATESTDIR)
503         $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(configenv) $(GNUC) $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
504         touch $@
505
506
507 .PHONY: in-place
508 in-place:       $(host)-stamp-in-place
509
510 $(host)-stamp-in-place: 
511         PATH=/bin:/usr/bin:/usr/ucb ; \
512           export PATH ; \
513           SHELL=/bin/sh ; export SHELL ; \
514           $(TIME) $(GNU_MAKE) -f test-build.mk $(host)-stamp-in-place-installed host=$(host) $(FLAGS_TO_PASS)
515         touch $@
516         if [ -f CLEAN_ALL ] ; then \
517           rm -rf $(INPLACEDIR) ; \
518         else \
519           mv $(INPLACEDIR) $(STAGE1DIR) ; \
520         fi
521
522 $(host)-stamp-in-place-installed: $(host)-stamp-in-place-checked
523         cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host)
524         cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host)
525         touch $@
526
527 $(host)-stamp-in-place-checked: $(host)-stamp-in-place-built
528 #       cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host)
529         touch $@
530
531 $(host)-stamp-in-place-built: $(host)-stamp-in-place-configured
532         cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host)
533         cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host)
534         touch $@
535
536 $(host)-stamp-in-place-configured: $(host)-stamp-in-place-cp
537         cd $(INPLACEDIR) ; $(configenv) CC="$(CC)" $(TIME) $(CONFIG_SHELL) ./configure $(config) -v $(prefixes) $(configargs)
538         touch $@
539
540 $(host)-stamp-in-place-cp:
541         rm -rf $(INPLACEDIR)
542         mkdir $(INPLACEDIR)
543         (cd $(TREE) ; tar cf - .) | (cd $(INPLACEDIR) ; tar xf -)
544         touch $@
545
546 $(host)-stamp-3stage-done: do1 do2 do3 comparison
547         touch $@
548
549
550 .PHONY: do1
551 do1:        $(HOLESSTAMP) $(host)-stamp-stage1
552 do1-config: $(HOLESSTAMP) $(host)-stamp-stage1-configured
553 do1-build:  $(HOLESSTAMP) $(host)-stamp-stage1-checked
554
555 do1-vault: $(HOLESSTAMP) $(host)-stamp-stage1-built
556         if [ -d $(WORKING_DIR).1 ] ; then \
557           $(SET_NATIVE_HOLES) cd $(WORKING_DIR).1 ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
558         else \
559           $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(CFLAGS)" vault-install ; \
560         fi
561
562 $(host)-stamp-stage1:
563         if [ -d $(STAGE1DIR) ] ; then \
564                 mv $(STAGE1DIR) $(WORKING_DIR) ; \
565         else \
566                 true ; \
567         fi
568         $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) $(host)-stamp-stage1-installed
569         touch $@
570         if [ -f CLEAN_ALL ] ; then \
571           rm -rf $(WORKING_DIR) ; \
572         else \
573           mv $(WORKING_DIR) $(STAGE1DIR) ; \
574         fi
575
576 $(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked
577         $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host)
578         $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host)
579 ifeq ($(host),rs6000-ibm-aix)
580         -rm $(relbindir)/make
581 endif
582 ifeq ($(host),rs6000-ibm-aix3.2.5)
583         -rm $(relbindir)/make
584 endif
585         touch $@
586
587 $(host)-stamp-stage1-checked: $(host)-stamp-stage1-built
588 #       $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host)
589         touch $@
590
591 $(host)-stamp-stage1-built: $(host)-stamp-stage1-configured
592         $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host)
593         $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host)
594         touch $@
595
596 $(host)-stamp-stage1-configured:
597         [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
598         $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; \
599           $(configenv) CC="$(CC)" $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
600         touch $@
601
602 .PHONY: do2
603 do2:    $(HOLESDIR) $(host)-stamp-stage2
604
605 do2-vault: $(HOLESSTAMP) $(host)-stamp-stage2-built
606         if [ -d $(WORKING_DIR).2 ] ; then \
607           $(SET_CYGNUS_PATH) cd $(WORKING_DIR).2 ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(GNUCFLAGS)" vault-install ; \
608         else \
609           $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(GNUCFLAGS)" vault-install ; \
610         fi
611
612
613
614 $(host)-stamp-stage2:
615         if [ -d $(STAGE2DIR) ] ; then \
616                 mv $(STAGE2DIR) $(WORKING_DIR) ; \
617         else \
618                 true ; \
619         fi
620         $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage2-installed
621         mv $(WORKING_DIR) $(STAGE2DIR)
622         touch $@
623
624
625 # The SunOS make program gets confused when it is deleted while running.
626 # The signal handlers return to the wrong place, or something, and the
627 # program dumps core.  To avoid trouble with installing make over itself,
628 # we delete the installed make program.
629 $(host)-stamp-stage2-installed: $(host)-stamp-stage2-checked
630         -rm -f $(relbindir)/make
631         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(GNU_MAKE) -w $(FLAGS_TO_PASS) $(GNUC) install host=$(host)
632         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) install-info host=$(host)
633         touch $@
634
635 $(host)-stamp-stage2-checked: $(host)-stamp-stage2-built
636 #       $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) check host=$(host)
637         touch $@
638
639 $(host)-stamp-stage2-built: $(host)-stamp-stage2-configured
640         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) all host=$(host)
641         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) info host=$(host)
642         touch $@
643
644 $(host)-stamp-stage2-configured:
645         [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
646         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
647           $(configenv) $(GNUC) $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
648         touch $@
649
650 .PHONY: do3
651 do3:    $(HOLESDIR) $(host)-stamp-stage3
652
653 do3-vault: $(HOLESSTAMP) $(host)-stamp-stage3-built
654         if [ -d $(WORKING_DIR).3 ] ; then \
655           $(SET_CYGNUS_PATH) cd $(WORKING_DIR).3 ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(GNUCFLAGS)" vault-install ; \
656         else \
657           $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(MAKE) $(FLAGS_TO_PASS) host=$(host) "CFLAGS=$(GNUCFLAGS)" vault-install ; \
658         fi
659
660 $(host)-stamp-stage3:
661         if [ -d $(STAGE3DIR) ] ; then \
662                 mv $(STAGE3DIR) $(WORKING_DIR) ; \
663         else \
664                 true ; \
665         fi
666         $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage3-installed
667         mv $(WORKING_DIR) $(STAGE3DIR) 
668         touch $@
669
670
671 # The SunOS make program gets confused when it is deleted while running.
672 # The signal handlers return to the wrong place, or something, and the
673 # program dumps core.  To avoid trouble with installing make over itself,
674 # we delete the installed make program.
675 $(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked
676         -rm -f $(relbindir)/make
677         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(GNU_MAKE) -w $(FLAGS_TO_PASS) $(GNUC) install host=$(host)
678         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) install-info host=$(host)
679         if [ -f VAULT-INSTALL ] ; then \
680           $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(MAKE) $(FLAGS_TO_PASS) $(GNUC) vault-install ; \
681         else true ; fi
682         touch $@
683
684 $(host)-stamp-stage3-checked: $(host)-stamp-stage3-built
685 #       $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) check host=$(host)
686         touch $@
687
688 $(host)-check-3stage: $(host)-stamp-stage3
689         $(SET_CYGNUS_PATH) cd $(STAGE3DIR) ; $(TIME) $(MAKE) -k -w $(FLAGS_TO_PASS) $(GNUC) check host=$(host)
690         touch $@
691
692 $(host)-stamp-stage3-built: $(host)-stamp-stage3-configured
693         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) all host=$(host)
694         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) info host=$(host)
695         touch $@
696
697 $(host)-stamp-stage3-configured:
698         [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
699         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
700           $(configenv) $(GNUC) $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
701         touch $@
702
703 .PHONY: do4
704 do4:    $(HOLESDIR) $(host)-stamp-stage4
705
706 $(host)-stamp-stage4:
707         if [ -d $(STAGE4DIR) ] ; then \
708                 mv $(STAGE4DIR) $(WORKING_DIR) ; \
709         else \
710                 true ; \
711         fi
712         $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage4-checked 
713         mv $(WORKING_DIR) $(STAGE4DIR) 
714         touch $@
715
716
717 $(host)-stamp-stage4-installed: $(host)-stamp-stage4-checked
718         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) install host=$(host)
719         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) install-info host=$(host)
720         touch $@
721
722 $(host)-stamp-stage4-checked: $(host)-stamp-stage4-built
723 #       $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) check host=$(host)
724         touch $@
725
726 $(host)-stamp-stage4-built: $(host)-stamp-stage4-configured
727         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) all host=$(host)
728         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) info host=$(host)
729         touch $@
730
731 $(host)-stamp-stage4-configured:
732         [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
733         $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
734           $(configenv) $(GNUC) $(TIME) $(CONFIG_SHELL) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
735         touch $@
736
737 # These things are needed by a three-stage, but are not included locally.
738
739 HOLES := \
740         [ \
741         ar \
742         as \
743         awk \
744         basename \
745         cat \
746         cc \
747         chmod \
748         chgrp \
749         chown \
750         cmp \
751         cp \
752         cpio \
753         date \
754         diff \
755         dirname \
756         echo \
757         egrep \
758         ex \
759         expr \
760         false \
761         find \
762         grep \
763         head \
764         hostname \
765         install \
766         ld \
767         lex \
768         ln \
769         ls \
770         make \
771         mkdir \
772         mv \
773         nm \
774         pwd \
775         ranlib \
776         rm \
777         rmdir \
778         sed \
779         sh \
780         sleep \
781         sort \
782         tail \
783         tar \
784         test \
785         time \
786         touch \
787         tr \
788         true \
789         uname \
790         uniq \
791         uptime \
792         uudecode \
793         wc \
794         whoami
795
796 ### so far only sun make supports VPATH
797 ifeq ($(subst sun3,sun4,$(holesys)),sun4)
798 MAKE_HOLE :=
799 else
800 MAKE_HOLE := make
801 endif
802
803 ### solaris 2 -- don't use /usr/ucb/cc
804 ifeq (sparc-sun-solaris2,$(holesys))
805 SET_NATIVE_HOLES := SHELL=$(SHELL) ; PATH=/opt/SUNWspro/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
806 HOLE_DIRS := /usr/ccs/bin
807 CC_HOLE :=
808 NUKEM := cc 
809 endif
810
811 ifeq ($(host),i386-go32)
812 DOS_HOLES := aout2exe doschk file
813 endif
814
815 ifeq ($(host),i386-lynx)
816 MAKE_HOLE := make
817 endif
818
819 ifeq ($(host),m68k-lynx)
820 MAKE_HOLE := make
821 endif
822
823 ifeq ($(host),sparc-lynx)
824 MAKE_HOLE := make
825 endif
826
827 ifeq ($(host),rs6000-lynx)
828 MAKE_HOLE := make
829 endif
830
831 ### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required.
832 PARTIAL_HOLES := \
833         $(MAKE_HOLE) \
834         $(CC_HOLE) \
835         $(DOS_HOLES) \
836         flex \
837         m4
838
839 ### look in these directories for things missing from a three-stage
840 HOLE_DIRS := \
841         $(HOLE_DIRS) \
842         /bin \
843         /usr/bin \
844         /usr/ucb \
845         /etc /usr/etc \
846         /usr/unsupported/bin
847
848 ### look in these directories for alternate versions of some tools.
849 PARTIAL_HOLE_DIRS := \
850         /usr/latest/bin \
851         /usr/progressive/bin \
852         $(PARTIAL_HOLE_DIRS) \
853         /usr/vintage/bin \
854         /usr/unsupported/bin \
855         $(HOLE_DIRS)
856
857 $(HOLESDIR): $(holesys)-stamp-holes
858
859 $(holesys)-stamp-holes:
860         -rm -rf $(HOLESDIR)
861         -mkdir $(HOLESDIR)
862         @for i in $(HOLES) ; do \
863                 found= ; \
864                 for j in $(HOLE_DIRS) ; do \
865                         if [ -x $$j/$$i ] ; then \
866                                 ln -s $$j/$$i $(HOLESDIR) || cp $$j/$$i $(HOLESDIR) ; \
867                                 echo $$i from $$j ; \
868                                 found=t ; \
869                                 break ; \
870                         fi ; \
871                 done ; \
872                 case "$$found" in \
873                 t) ;; \
874                 *) echo $$i is NOT found ;; \
875                 esac ; \
876         done
877         @for i in $(PARTIAL_HOLES) ; do \
878                 found= ; \
879                 for j in $(PARTIAL_HOLE_DIRS) ; do \
880                         if [ -x $$j/$$i ] ; then \
881                                 rm -f $(HOLESDIR)/$$i ; \
882                                 cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \
883                                 echo $$i from $$j ; \
884                                 found=t ; \
885                                 break ; \
886                         fi ; \
887                 done ; \
888                 case "$$found" in \
889                 t) ;; \
890                 *) echo $$i is NOT found ;; \
891                 esac ; \
892         done
893 ifdef NUKEM
894         cd $(HOLESDIR); rm -f $(NUKEM)
895 endif
896         touch $@
897
898 # Get the cross-tools for build cross host when not building on the host.
899
900 BUILD_HOST_HOLES := \
901         byacc \
902         gcc \
903         makeinfo \
904         $(AR) \
905         $(AS) \
906         $(CC) \
907         $(CXX) \
908         $(GXX) \
909         $(NM) \
910         $(RANLIB)
911
912 BUILD_HOLES_DIRS := $(release_root)/H-$(build)/bin $(PARTIAL_HOLE_DIRS)
913
914 ifdef BUILD_HOST_HOLES_DIR
915 $(BUILD_HOST_HOLES_DIR): $(build)-x-$(host)-stamp-holes
916 endif
917
918 ifneq ($(build),$(host))
919 $(build)-x-$(host)-stamp-holes:
920         -rm -rf $(BUILD_HOST_HOLES_DIR)
921         -mkdir $(BUILD_HOST_HOLES_DIR)
922         @for i in $(BUILD_HOST_HOLES) ; do \
923                 found= ; \
924                 for j in $(BUILD_HOLES_DIRS) ; do \
925                         if [ -x $$j/$$i ] ; then \
926                                 ln -s $$j/$$i $(BUILD_HOST_HOLES_DIR) || cp $$j/$$i $(BUILD_HOST_HOLES_DIR) ; \
927                                 echo $$i from $$j ; \
928                                 found=t ; \
929                                 break ; \
930                         fi ; \
931                 done ; \
932                 case "$$found" in \
933                 t) ;; \
934                 *) echo $$i is NOT found ;; \
935                 esac ; \
936         done
937         touch $@
938 endif
939
940 # Get the cross tools for build cross target when not building on the host.
941
942 BUILD_TARGET_HOLES := \
943         byacc \
944         gcc \
945         makeinfo \
946         $(AR_FOR_TARGET) \
947         $(AS_FOR_TARGET) \
948         $(CC_FOR_TARGET) \
949         $(CXX_FOR_TARGET) \
950         $(GXX_FOR_TARGET) \
951         $(NM_FOR_TARGET) \
952         $(RANLIB_FOR_TARGET)
953
954 ifdef BUILD_TARGET_HOLES_DIR
955 $(BUILD_TARGET_HOLES_DIR): $(build)-x-$(target)-stamp-holes
956 endif
957
958 ifneq ($(build),$(target))
959 $(build)-x-$(target)-stamp-holes:
960         -rm -rf $(BUILD_TARGET_HOLES_DIR)
961         -mkdir $(BUILD_TARGET_HOLES_DIR)
962         @for i in $(BUILD_TARGET_HOLES) ; do \
963                 found= ; \
964                 for j in $(BUILD_HOLES_DIRS) ; do \
965                         if [ -x $$j/$$i ] ; then \
966                                 ln -s $$j/$$i $(BUILD_TARGET_HOLES_DIR) || cp $$j/$$i $(BUILD_TARGET_HOLES_DIR) ; \
967                                 echo $$i from $$j ; \
968                                 found=t ; \
969                                 break ; \
970                         fi ; \
971                 done ; \
972                 case "$$found" in \
973                 t) ;; \
974                 *) echo $$i is NOT found ;; \
975                 esac ; \
976         done
977         touch $@
978 endif
979
980 .PHONY: comparison
981 comparison: $(host)-stamp-3stage-compared
982 comparison-stage3to4: $(host)-stamp-4stage-compared
983
984 $(host)-stamp-3stage-compared:
985         rm -f .bad-compare
986 ifeq ($(patsubst %-lynx,mips-sgi-irix4,$(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)
987         for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
988                 tail +10c $(STAGE2DIR)/$$i > foo1 ; \
989                 tail +10c $(STAGE3DIR)/$$i > foo2 ; \
990                 if cmp foo1 foo2 ; then \
991                         true ; \
992                 else \
993                         echo $$i ; \
994                         touch .bad-compare ; \
995                 fi ; \
996         done
997         rm -f foo1 foo2
998 else
999         for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
1000                 cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i || touch .bad-compare ; \
1001         done
1002 endif
1003         if [ -f CLEAN_ALL ] ; then \
1004           rm -rf $(STAGE2DIR) $(STAGE3DIR) ; \
1005         else \
1006           if [ -f CLEAN_STAGES ] ; then \
1007             if [ -f .bad-compare ] ; then \
1008               true ; \
1009             else \
1010               rm -rf $(STAGE1DIR) $(STAGE2DIR) ; \
1011             fi ; \
1012           else true ; \
1013           fi ; \
1014         fi
1015         touch $@        
1016
1017 $(host)-stamp-4stage-compared:
1018         rm -f .bad-compare
1019 ifeq ($(patsubst %-lynx,mips-sgi-irix4,$(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)
1020         for i in `cd $(STAGE4DIR) ; find . -name \*.o -print` ; do \
1021                 tail +10c $(STAGE3DIR)/$$i > foo1 ; \
1022                 tail +10c $(STAGE4DIR)/$$i > foo2 ; \
1023                 if cmp foo1 foo2 ; then \
1024                         true ; \
1025                 else \
1026                         echo $$i ; \
1027                         touch .bad-compare ; \
1028                 fi ; \
1029         done
1030         rm -f foo1 foo2
1031 else
1032         for i in `cd $(STAGE4DIR) ; find . -name \*.o -print` ; do \
1033                 cmp $(STAGE3DIR)/$$i $(STAGE4DIR)/$$i || touch .bad-compare ; \
1034         done
1035 endif
1036         if [ -f CLEAN_ALL ] ; then \
1037           rm -rf $(STAGE2DIR) $(STAGE3DIR) $(STAGE4DIR) ; \
1038         else \
1039           if [ -f CLEAN_STAGES ] ; then \
1040             if [ -f .bad-compare ] ; then \
1041               true ; \
1042             else \
1043               rm -rf $(STAGE1DIR) $(STAGE2DIR) $(STAGE3DIR) ; \
1044             fi ; \
1045           else true ; \
1046           fi ; \
1047         fi
1048
1049 .PHONY: clean
1050 clean:
1051         rm -rf $(HOLESDIR) $(INPLACEDIR) $(WORKING_DIR)* $(host)-stamp-* *~
1052
1053 .PHONY: very
1054 very:
1055         rm -rf $(TREE)
1056
1057 force:
1058
1059 endif # host
1060
1061 ### Local Variables:
1062 ### fill-column: 131
1063 ### End: