+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 $@
+