diff options
author | Simon Marlow <marlowsd@gmail.com> | 2013-01-17 11:52:15 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2013-01-17 12:39:55 +0000 |
commit | 109a1e53287f50103e8a5b592275940b6e3dbb53 (patch) | |
tree | 0cc3389e7a18318553be973b63577114a8c465f6 /compiler/ghc.mk | |
parent | 900e7d255e2e41bab50e239f9b12c30bd6254881 (diff) | |
download | haskell-109a1e53287f50103e8a5b592275940b6e3dbb53.tar.gz |
Tidy up cross-compiling
We have two cases:
1. building a cross-compiler
2. compiling GHC to run on a foreign platform
These two are done with almost the same setup: (1) is the stage 1
compiler, and (2) is the stage 2 compiler, when CrossCompiling=YES.
The only difference between (1) and (2) is that you if you set up the
build for (1), then it stops before stage 2 and you can 'make install'
to install stage 1.
Unfortunately, (2) didn't work, and the build system code needed some
tidying up.
Change to the way the build is set up:
Before
------
To build a cross-compiler:
./configure --target=<..>
To compile a foreign GHC:
./configure --host=<..> --target=<..>
Now
---
To build a cross-compiler:
./configure --target=<..>
And set "Stage1Only=YES" in mk/build.mk
To compile a foreign GHC:
./configure --target=<..>
Diffstat (limited to 'compiler/ghc.mk')
-rw-r--r-- | compiler/ghc.mk | 99 |
1 files changed, 47 insertions, 52 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 24c11b8448..9621f1de4b 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -130,53 +130,48 @@ endif PLATFORM_H = ghc_boot_platform.h -ifeq "$(BuildingCrossCompiler)" "YES" -compiler/stage1/$(PLATFORM_H) : compiler/stage2/$(PLATFORM_H) - cp $< $@ -else compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. $(call removeFiles,$@) @echo "Creating $@..." @echo "#ifndef __PLATFORM_H__" >> $@ @echo "#define __PLATFORM_H__" >> $@ @echo >> $@ - @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ - @echo "#define HostPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ - @echo "#define TargetPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ - @echo >> $@ - @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ - @echo "#define $(BuildPlatform_CPP)_HOST 1" >> $@ - @echo "#define $(HostPlatform_CPP)_TARGET 1" >> $@ - @echo >> $@ - @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@ - @echo "#define $(BuildArch_CPP)_HOST_ARCH 1" >> $@ - @echo "#define $(HostArch_CPP)_TARGET_ARCH 1" >> $@ - @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@ - @echo "#define HOST_ARCH \"$(BuildArch_CPP)\"" >> $@ - @echo "#define TARGET_ARCH \"$(HostArch_CPP)\"" >> $@ - @echo >> $@ - @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@ - @echo "#define $(BuildOS_CPP)_HOST_OS 1" >> $@ - @echo "#define $(HostOS_CPP)_TARGET_OS 1" >> $@ - @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@ - @echo "#define HOST_OS \"$(BuildOS_CPP)\"" >> $@ - @echo "#define TARGET_OS \"$(HostOS_CPP)\"" >> $@ -ifeq "$(HostOS_CPP)" "irix" - @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@ - @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@ - @echo "#endif" >> $@ + @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ + @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ + @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ + @echo >> $@ + @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ + @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@ + @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@ + @echo >> $@ + @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@ + @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@ + @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@ + @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@ + @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@ + @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@ + @echo >> $@ + @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@ + @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@ + @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@ + @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@ + @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@ + @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@ +ifeq "$(TargetOS_CPP)" "irix" + @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@ + @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@ + @echo "#endif" >> $@ endif - @echo >> $@ - @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@ - @echo "#define $(BuildVendor_CPP)_HOST_VENDOR 1" >> $@ - @echo "#define $(HostVendor_CPP)_TARGET_VENDOR 1" >> $@ - @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@ - @echo "#define HOST_VENDOR \"$(BuildVendor_CPP)\"" >> $@ - @echo "#define TARGET_VENDOR \"$(HostVendor_CPP)\"" >> $@ - @echo >> $@ - @echo "#endif /* __PLATFORM_H__ */" >> $@ + @echo >> $@ + @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@ + @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@ + @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@ + @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@ + @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@ + @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@ + @echo >> $@ + @echo "#endif /* __PLATFORM_H__ */" >> $@ @echo "Done." -endif # For stage2 and above, the BUILD platform is the HOST of stage1, and # the HOST platform is the TARGET of stage1. The TARGET remains the same @@ -187,26 +182,26 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. @echo "#ifndef __PLATFORM_H__" >> $@ @echo "#define __PLATFORM_H__" >> $@ @echo >> $@ - @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@ - @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ + @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@ + @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@ @echo >> $@ - @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ - @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@ + @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@ + @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@ @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@ @echo >> $@ - @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@ - @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@ + @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@ + @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@ @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@ @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@ - @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@ + @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo >> $@ @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@ - @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@ + @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@ @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@ - @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@ + @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@ @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@ ifeq "$(TargetOS_CPP)" "irix" @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS" >> $@ @@ -214,11 +209,11 @@ ifeq "$(TargetOS_CPP)" "irix" @echo "#endif" >> $@ endif @echo >> $@ - @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@ - @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@ + @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@ + @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@ @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@ - @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@ - @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@ + @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@ + @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@ @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@ @echo >> $@ @echo "#endif /* __PLATFORM_H__ */" >> $@ |