[commit: ghc] master: Build system: don't set GhcLibWays explicitly in build.mk.sample (#10536) (37de4ad)

git at git.haskell.org git at git.haskell.org
Tue Jul 7 10:40:46 UTC 2015


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

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

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

commit 37de4ad76b75d403e6a8dae9539af08c859d46a4
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Mon Jun 29 22:42:42 2015 +0200

    Build system: don't set GhcLibWays explicitly in build.mk.sample (#10536)
    
    We used to have the following in mk/build.mk.sample:
    
      GhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)
    
    This commit removes that statement for the following reasons:
    
      1) It depends on the variable DYNAMIC_GHC_PROGRAMS, which is set later
         in the file for some BuildFlavours. Although this works because
         `make` does multiple passes when reading Makefiles, it is confusing
         to users [1]. Instead, test for DYNAMIC_GHC_PROGRAMS in
         mk/config.mk.in.
    
      2) Although it looks like that line is about compiling the `dyn` way,
         its purpose is really to not build the `prof` way. This commit
         introduces the variable BUILD_PROF_LIBS, to make this more
         explicit.
    
    This simplifies mk/build.mk.sample and mk/validate-settings.mk.
    
    Note that setting GhcLibWays explicitly still works, and
    DYNAMIC_GHC_PROGRAMS=NO in build.mk does not build the `dyn` way.
    
    [1] https://mail.haskell.org/pipermail/ghc-devs/2014-December/007725.html
    
    Differential Revision: https://phabricator.haskell.org/D1021


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

37de4ad76b75d403e6a8dae9539af08c859d46a4
 mk/build.mk.sample      | 42 +++++++++++++++++++++---------------------
 mk/config.mk.in         | 15 ++++++++++-----
 mk/validate-settings.mk | 15 ++-------------
 3 files changed, 33 insertions(+), 39 deletions(-)

diff --git a/mk/build.mk.sample b/mk/build.mk.sample
index 7969b40..3f97702 100644
--- a/mk/build.mk.sample
+++ b/mk/build.mk.sample
@@ -72,8 +72,6 @@ V = 1
 # Uncomment the following line to enable building DPH
 #BUILD_DPH=YES
 
-GhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)
-
 # Uncomment the following to force `integer-gmp` to use the in-tree GMP 5.0.4
 # (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`)
 #libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
@@ -84,40 +82,34 @@ ifeq "$(BuildFlavour)" "perf"
 
 # perf matches the default settings, repeated here for comparison:
 
-SRC_HC_OPTS     = -O -H64m
-GhcStage1HcOpts = -O
-GhcStage2HcOpts = -O2
-GhcLibHcOpts    = -O2
+SRC_HC_OPTS        = -O -H64m
+GhcStage1HcOpts    = -O
+GhcStage2HcOpts    = -O2
+GhcLibHcOpts       = -O2
+BUILD_PROF_LIBS    = YES
 #SplitObjs
 #HADDOCK_DOCS
 #BUILD_DOCBOOK_HTML
 #BUILD_DOCBOOK_PS
 #BUILD_DOCBOOK_PDF
 
-GhcLibWays  = v
-GhcLibWays += p
-ifeq "$(PlatformSupportsSharedLibs)" "YES"
-GhcLibWays += dyn
-endif
-
 endif
 
 # ---------------- Perf build using LLVM --------------------------------------
 
 ifeq "$(BuildFlavour)" "perf-llvm"
 
-SRC_HC_OPTS     = -O -H64m -fllvm
-GhcStage1HcOpts = -O -fllvm
-GhcStage2HcOpts = -O2 -fllvm
-GhcLibHcOpts    = -O2
+SRC_HC_OPTS        = -O -H64m -fllvm
+GhcStage1HcOpts    = -O -fllvm
+GhcStage2HcOpts    = -O2 -fllvm
+GhcLibHcOpts       = -O2
+BUILD_PROF_LIBS    = YES
 #SplitObjs
 #HADDOCK_DOCS
 #BUILD_DOCBOOK_HTML
 #BUILD_DOCBOOK_PS
 #BUILD_DOCBOOK_PDF
 
-GhcLibWays     += p
-
 endif
 
 # ------- A Perf build configured for cross-compilation ----------------------
@@ -128,14 +120,13 @@ SRC_HC_OPTS        = -O -H64m -fllvm
 GhcStage1HcOpts    = -O2
 GhcStage2HcOpts    = -O2 -fllvm
 GhcLibHcOpts       = -O2
+BUILD_PROF_LIBS    = YES
 #SplitObjs
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
 BUILD_DOCBOOK_PS   = NO
 BUILD_DOCBOOK_PDF  = NO
 
-GhcLibWays        += p
-
 INTEGER_LIBRARY      = integer-simple
 Stage1Only           = YES
 DYNAMIC_BY_DEFAULT   = NO
@@ -151,6 +142,7 @@ SRC_HC_OPTS        = -H64m -O0
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O0
 GhcLibHcOpts       = -O0
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -167,6 +159,7 @@ SRC_HC_OPTS        = -H64m -O0
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O0
 GhcLibHcOpts       = -O
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -183,6 +176,7 @@ SRC_HC_OPTS        = -H64m -O0 -fllvm
 GhcStage1HcOpts    = -O -fllvm
 GhcStage2HcOpts    = -O0 -fllvm
 GhcLibHcOpts       = -O -fllvm
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -199,6 +193,7 @@ SRC_HC_OPTS        = -H64m -O0
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O0 -fllvm
 GhcLibHcOpts       = -O -fllvm
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -220,13 +215,13 @@ SRC_HC_OPTS        = -H64m -O0
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O
 GhcLibHcOpts       = -O
+BUILD_PROF_LIBS    = YES
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
 BUILD_DOCBOOK_PS   = NO
 BUILD_DOCBOOK_PDF  = NO
 
-GhcLibWays        += p
 GhcProfiled        = YES
 
 endif
@@ -239,6 +234,7 @@ SRC_HC_OPTS        = -H64m -O
 GhcStage1HcOpts    = -O0 -DDEBUG
 GhcStage2HcOpts    = -O
 GhcLibHcOpts       = -O -dcore-lint
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -257,6 +253,7 @@ SRC_HC_OPTS        = -H64m -O
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O0 -DDEBUG
 GhcLibHcOpts       = -O -dcore-lint
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -275,6 +272,7 @@ SRC_HC_OPTS        = -O -H64m
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O0
 GhcLibHcOpts       = -O2
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -291,6 +289,7 @@ SRC_HC_OPTS        = -O -H64m
 GhcStage1HcOpts    = -O -fllvm
 GhcStage2HcOpts    = -O0 -fllvm
 GhcLibHcOpts       = -O2 -fllvm
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
@@ -307,6 +306,7 @@ SRC_HC_OPTS        = -O -H64m
 GhcStage1HcOpts    = -O
 GhcStage2HcOpts    = -O0
 GhcLibHcOpts       = -O2
+BUILD_PROF_LIBS    = NO
 SplitObjs          = NO
 HADDOCK_DOCS       = NO
 BUILD_DOCBOOK_HTML = NO
diff --git a/mk/config.mk.in b/mk/config.mk.in
index ebc1992..bcdebbf 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -219,15 +219,20 @@ ExtraMakefileSanityChecks = NO
 INTEGER_LIBRARY=integer-gmp
 
 # We build the libraries at least the "vanilla" way (way "v")
+# Technically we don't need the v way if DYNAMIC_GHC_PROGRAMS is YES,
+# but with -dynamic-too it's cheap, and makes life easier.
 GhcLibWays = v
 
 # In addition to the normal sequential way, the default is to also build
 # profiled prelude libraries
-GhcLibWays += p
-
-ifeq "$(PlatformSupportsSharedLibs)" "YES"
-GhcLibWays += dyn
-endif
+# $(if $(filter ...)) allows controlling this expression from build.mk.
+GhcLibWays += $(if $(filter $(BUILD_PROF_LIBS),NO),,p)
+
+# Backward compatibility: although it would be cleaner to test for
+# PlatformSupportsSharedLibs, or perhaps a new variable BUILD_SHARED_LIBS,
+# some users currently expect that DYNAMIC_GHC_PROGRAMS=NO in build.mk implies
+# that dyn is not added to GhcLibWays.
+GhcLibWays += $(if $(filter $(DYNAMIC_GHC_PROGRAMS),NO),,dyn)
 
 # Handy way to test whether we're building shared libs or not.
 BuildSharedLibs=$(strip $(if $(findstring dyn,$(GhcLibWays)),YES,NO))
diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk
index ef3a58e..c71158e 100644
--- a/mk/validate-settings.mk
+++ b/mk/validate-settings.mk
@@ -14,19 +14,8 @@ GhcStage2HcOpts += -O -dcore-lint
 
 GhcLibHcOpts    += -O -dcore-lint
 
-# We define DefaultFastGhcLibWays in this style so that the value is
-# correct even if the user alters DYNAMIC_GHC_PROGRAMS.
-# Technically we don't need the v way if DYNAMIC_GHC_PROGRAMS is YES,
-# but with -dynamic-too it's cheap, and makes life easier.
-DefaultFastGhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)
-DefaultProfGhcLibWays = $(if $(filter $(GhcProfiled),YES),p,)
-
-ifeq "$(ValidateSpeed)" "FAST"
-GhcLibWays     = $(DefaultFastGhcLibWays)
-else
-GhcLibWays     := $(filter v dyn,$(GhcLibWays))
-endif
-GhcLibWays     += $(DefaultProfGhcLibWays)
+BUILD_PROF_LIBS = NO
+
 SplitObjs       = NO
 NoFibWays       =
 STRIP_CMD       = :



More information about the ghc-commits mailing list