[project @ 2005-10-17 09:36:39 by simonmar]
authorsimonmar <unknown>
Mon, 17 Oct 2005 09:36:39 +0000 (09:36 +0000)
committersimonmar <unknown>
Mon, 17 Oct 2005 09:36:39 +0000 (09:36 +0000)
if TARGETPLATFORM differs from HOSTPLATFORM, don't attempt to build
DerivedConstants,h, ghcautoconf.h and GHCConstants.h.  If these aren't
present, emit a message to remind the user to copy them from the
target system.  Hopefully this should make bootstrapping slightly less
error prone.

ghc/includes/Makefile

index 8d9e044..cd2719d 100644 (file)
@@ -34,6 +34,14 @@ gmp.h : $(FPTOOLS_TOP)/ghc/rts/gmp/gmp.h
 # definitions to avoid clashes), prepending some make variables specifying cpp
 # platform variables.
 
+ifneq "$(TARGETPLATFORM)"  "$(HOSTPLATFORM)"
+
+$(H_CONFIG) :
+       @echo "*** Cross-compiling: please copy $(H_CONFIG) from the target system"
+       @exit 1
+
+else
+
 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
 
 $(H_CONFIG) : Makefile
@@ -44,6 +52,8 @@ $(H_CONFIG) : Makefile
        @echo "#endif /* __GHCAUTOCONF_H__ */"          >> $@
        @echo "Done."
 
+endif
+
 $(H_PLATFORM) : Makefile
        @echo "Creating $@..."
        @$(RM) $@
@@ -93,6 +103,14 @@ endif
 
 all :: DerivedConstants.h
 
+ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
+
+DerivedConstants.h :
+       @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
+       @exit 1
+
+else
+
 mkDerivedConstants.c : $(H_CONFIG)
 
 mkDerivedConstantsHdr : mkDerivedConstants.o
@@ -101,6 +119,8 @@ mkDerivedConstantsHdr : mkDerivedConstants.o
 DerivedConstants.h : mkDerivedConstantsHdr
        ./mkDerivedConstantsHdr >$@
 
+endif
+
 CLEAN_FILES += mkDerivedConstantsHdr$(exeext) DerivedConstants.h
 
 # -----------------------------------------------------------------------------
@@ -108,6 +128,14 @@ CLEAN_FILES += mkDerivedConstantsHdr$(exeext) DerivedConstants.h
 
 all :: GHCConstants.h
 
+ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
+
+GHCConstants.h :
+       @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
+       @exit 1
+
+else
+
 mkGHCConstants : mkGHCConstants.o
        $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkGHCConstants.o
 
@@ -117,6 +145,8 @@ mkGHCConstants.o : mkDerivedConstants.c
 GHCConstants.h : mkGHCConstants
        ./mkGHCConstants >$@
 
+endif
+
 CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h
 
 # ---------------------------------------------------------------------------