[commit: ghc] master: Remove directories from include paths (ea310f9)

git at git.haskell.org git at git.haskell.org
Fri Sep 16 16:20:57 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ea310f9956179f91ca973bc747b0bc7b061bc174/ghc

>---------------------------------------------------------------

commit ea310f9956179f91ca973bc747b0bc7b061bc174
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Fri Sep 16 11:49:24 2016 -0400

    Remove directories from include paths
    
    Previously this was a relative path which worked in the GHC tree, but
    failed elsewhere. This caused trouble for out-of-tree users as well as
    Hadrian, which wants to move build artifacts out of the working
    directory. Fixes #8040.
    
    Test Plan: Validate
    
    Reviewers: thomie, austin, snowleopard, hvr
    
    Reviewed By: snowleopard, hvr
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2530
    
    GHC Trac Issues: #8040


>---------------------------------------------------------------

ea310f9956179f91ca973bc747b0bc7b061bc174
 compiler/HsVersions.h              | 2 +-
 compiler/ghc.mk                    | 5 +++++
 compiler/main/DynFlags.hs          | 3 ++-
 compiler/main/PlatformConstants.hs | 3 ++-
 rules/build-dependencies.mk        | 1 +
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index 6d5716d..83cbcf1 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -20,7 +20,7 @@ you will screw up the layout where they are used in case expressions!
  * ghcconfig.h, because that will include ghcplatform.h which has the
  * wrong platform settings for the compiler (it has the platform
  * settings for the target plat instead). */
-#include "../includes/ghcautoconf.h"
+#include "ghcautoconf.h"
 
 #define GLOBAL_VAR(name,value,ty)  \
 {-# NOINLINE name #-};             \
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 5aeda53..38eae0e 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -259,6 +259,11 @@ PRIMOP_BITS_STAGE3 = $(addprefix compiler/stage3/build/,$(PRIMOP_BITS_NAMES))
 compiler_CPP_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
 compiler_CPP_OPTS += ${GhcCppOpts}
 
+# We add these paths to the Haskell compiler's #include search path list since
+# we must avoid #including files by paths relative to the source file as Hadrian
+# moves the build artifacts out of the source tree. See #8040.
+compiler_HC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
+
 define preprocessCompilerFiles
 # $0 = stage
 compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 7546936..b642bea 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -4765,7 +4765,8 @@ compilerInfo dflags
     showBool False = "NO"
     isWindows = platformOS (targetPlatform dflags) == OSMinGW32
 
-#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellWrappers.hs"
+-- Produced by deriveConstants
+#include "GHCConstantsHaskellWrappers.hs"
 
 bLOCK_SIZE_W :: DynFlags -> Int
 bLOCK_SIZE_W dflags = bLOCK_SIZE dflags `quot` wORD_SIZE dflags
diff --git a/compiler/main/PlatformConstants.hs b/compiler/main/PlatformConstants.hs
index b2ca32b..c9a4072 100644
--- a/compiler/main/PlatformConstants.hs
+++ b/compiler/main/PlatformConstants.hs
@@ -10,5 +10,6 @@
 
 module PlatformConstants (PlatformConstants(..)) where
 
-#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellType.hs"
+-- Produced by deriveConstants
+#include "GHCConstantsHaskellType.hs"
 
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk
index 8152691..1905a0e 100644
--- a/rules/build-dependencies.mk
+++ b/rules/build-dependencies.mk
@@ -24,6 +24,7 @@ $1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES))
 
 $1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$($1_$2_WAYS),-dep-suffix "$$(patsubst %o,%,$$($$(way)_osuf))")
 $1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps
+$1_$2_MKDEPENDHS_FLAGS += $(addprefix -I,$($1_INCLUDE_DIRS))
 
 ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
 



More information about the ghc-commits mailing list