Pass LLVMTarget (identical to --target)
authorMoritz Angermann <moritz.angermann@gmail.com>
Thu, 11 May 2017 10:17:02 +0000 (18:17 +0800)
committerMoritz Angermann <moritz.angermann@gmail.com>
Thu, 11 May 2017 10:31:44 +0000 (18:31 +0800)
Sometimes it might be of interest to
have access to the raw target value when calling
subcommands (e.g. llvm tools with --target), as
such we forward the specified (or inferred)
--target for later consumption.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

Differential Revision: https://phabricator.haskell.org/D3559

aclocal.m4
compiler/ghc.mk
mk/project.mk.in

index 0d113c1..a7920a7 100644 (file)
@@ -136,9 +136,13 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
     TargetVendor_CPP=`  echo "$TargetVendor"   | sed -e 's/\./_/g' -e 's/-/_/g'`
     TargetOS_CPP=`      echo "$TargetOS"       | sed -e 's/\./_/g' -e 's/-/_/g'`
 
+    # we intend to pass trough --targets to llvm as is.
+    LLVMTarget_CPP=`    echo "$target"`
+
     echo "GHC build  : $BuildPlatform"
     echo "GHC host   : $HostPlatform"
     echo "GHC target : $TargetPlatform"
+    echo "LLVM target: $target"
 
     AC_SUBST(BuildPlatform)
     AC_SUBST(HostPlatform)
@@ -154,6 +158,7 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
     AC_SUBST(HostOS_CPP)
     AC_SUBST(BuildOS_CPP)
     AC_SUBST(TargetOS_CPP)
+    AC_SUBST(LLVMTarget_CPP)
 
     AC_SUBST(HostVendor_CPP)
     AC_SUBST(BuildVendor_CPP)
index d5498c4..2d2fede 100644 (file)
@@ -170,6 +170,7 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
        @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\""           >> $@
        @echo "#define HOST_ARCH \"$(HostArch_CPP)\""             >> $@
        @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\""         >> $@
+       @echo "#define LLVM_TARGET \"$(LLVMTarget_CPP)\""         >> $@
        @echo                                                     >> $@
        @echo "#define $(BuildOS_CPP)_BUILD_OS 1"                 >> $@
        @echo "#define $(HostOS_CPP)_HOST_OS 1"                   >> $@
@@ -211,6 +212,7 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
        @echo "#define BUILD_ARCH \"$(HostArch_CPP)\""            >> $@
        @echo "#define HOST_ARCH \"$(TargetArch_CPP)\""           >> $@
        @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\""         >> $@
+       @echo "#define LLVM_TARGET \"$(LLVMTarget_CPP)\""         >> $@
        @echo                                                     >> $@
        @echo "#define $(HostOS_CPP)_BUILD_OS 1"                  >> $@
        @echo "#define $(TargetOS_CPP)_HOST_OS 1"                 >> $@
index 03bd744..d620ed5 100644 (file)
@@ -12,7 +12,7 @@
 # Versioning scheme: A.B.C
 #         A: major version, decimal, any number of digits
 #         B: minor version, decimal, any number of digits
-#        C: patchlevel, one digit, omitted if zero.
+#     C: patchlevel, one digit, omitted if zero.
 #
 # ProjectVersionInt does *not* contain the patchlevel (rationale: this
 # figure is used for conditional compilations, and library interfaces
@@ -35,7 +35,7 @@ ProjectGitCommitId = @ProjectGitCommitId@
 
 ################################################################################
 #
-#              Platform variables
+#       Platform variables
 #
 ################################################################################
 
@@ -81,24 +81,25 @@ ProjectGitCommitId = @ProjectGitCommitId@
 # You have to do a lot of work by hand to cross compile: see the
 # section on "Porting GHC" in the Building Guide.
 
-HOSTPLATFORM                   = @HostPlatform@
-TARGETPLATFORM                 = @TargetPlatform@
-BUILDPLATFORM                  = @BuildPlatform@
+HOSTPLATFORM            = @HostPlatform@
+TARGETPLATFORM          = @TargetPlatform@
+BUILDPLATFORM           = @BuildPlatform@
 
-HostPlatform_CPP               = @HostPlatform_CPP@
-HostArch_CPP                   = @HostArch_CPP@
-HostOS_CPP                     = @HostOS_CPP@
-HostVendor_CPP                 = @HostVendor_CPP@
+HostPlatform_CPP        = @HostPlatform_CPP@
+HostArch_CPP            = @HostArch_CPP@
+HostOS_CPP              = @HostOS_CPP@
+HostVendor_CPP          = @HostVendor_CPP@
 
-TargetPlatform_CPP             = @TargetPlatform_CPP@
-TargetArch_CPP                 = @TargetArch_CPP@
-TargetOS_CPP                   = @TargetOS_CPP@
-TargetVendor_CPP                = @TargetVendor_CPP@
+TargetPlatform_CPP      = @TargetPlatform_CPP@
+TargetArch_CPP          = @TargetArch_CPP@
+TargetOS_CPP            = @TargetOS_CPP@
+TargetVendor_CPP        = @TargetVendor_CPP@
+LLVMTarget_CPP          = @LLVMTarget_CPP@
 
-BuildPlatform_CPP              = @BuildPlatform_CPP@
-BuildArch_CPP                  = @BuildArch_CPP@
-BuildOS_CPP                    = @BuildOS_CPP@
-BuildVendor_CPP                 = @BuildVendor_CPP@
+BuildPlatform_CPP       = @BuildPlatform_CPP@
+BuildArch_CPP           = @BuildArch_CPP@
+BuildOS_CPP             = @BuildOS_CPP@
+BuildVendor_CPP         = @BuildVendor_CPP@
 
 @HostPlatform_CPP@_HOST           = 1
 @TargetPlatform_CPP@_TARGET       = 1
@@ -118,7 +119,7 @@ BuildVendor_CPP                 = @BuildVendor_CPP@
 
 ################################################################################
 #
-#              Global configuration options
+#       Global configuration options
 #
 ################################################################################