[project @ 2005-01-26 16:03:40 by simonmar]
authorsimonmar <unknown>
Wed, 26 Jan 2005 16:03:41 +0000 (16:03 +0000)
committersimonmar <unknown>
Wed, 26 Jan 2005 16:03:41 +0000 (16:03 +0000)
Common up the ghc_ge_XXX variables into config.mk, and add the
ability to build ghc/lib and ghc/utils using the stage1 compiler, by
saying 'make UseStage1=YES'.  This is going to be useful for
bootstrapping.

ghc/lib/compat/Makefile
ghc/mk/config.mk.in
ghc/utils/genapply/Makefile
ghc/utils/genprimopcode/Makefile
ghc/utils/ghc-pkg/Makefile
ghc/utils/hsc2hs/Makefile

index 6365954..30c5d18 100644 (file)
@@ -7,6 +7,7 @@ ALL_DIRS = \
        Distribution \
        Distribution/Compat \
        System \
+       System/Directory \
        cbits
 
 LIBRARY = libghccompat.a
@@ -16,9 +17,7 @@ MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
 
 UseGhcForCc = YES
 
-ghc_603_plus = $(shell if (test $(GhcCanonVersion) -ge 603); then echo YES; else echo NO; fi)
-
-ifeq "$(ghc_603_plus)" "YES"
+ifeq "$(ghc_ge_603)" "YES"
 # These modules are all provided in GHC 6.3+
 EXCLUDED_SRCS += \
        System/Directory/Internals.hs \
index 2a787ca..27cfbd7 100644 (file)
@@ -31,3 +31,27 @@ GhcHasReadline       = @GhcHasReadline@
 
 # GTK+
 GTK_CONFIG = @GTK_CONFIG@
+
+# -----------------------------------------------------------------------------
+
+# We can build using the stage1 compiler by setting UseStage1=YES.
+# This is useful when building up a set of .hc files for
+# bootstrapping, because we need the ghc/lib/compat library and the
+# contents of ghc/utils compiled with the stage1 compiler.
+
+ifeq "$(UseStage1)" "YES"
+HC=$(GHC_STAGE1)
+MKDEPENDHS=$(GHC_STAGE1)
+endif
+
+# Some useful GHC version predicates:
+
+ifeq "$(UseStage1)" "YES"
+ghc_ge_504 = YES
+ghc_ge_601 = YES
+ghc_ge_603 = YES
+else
+ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
+ghc_ge_601 = $(shell if (test $(GhcCanonVersion) -ge 601); then echo YES; else echo NO; fi)
+ghc_ge_603 = $(shell if (test $(GhcCanonVersion) -ge 603); then echo YES; else echo NO; fi)
+endif
index 394d884..1b54fe5 100644 (file)
@@ -8,8 +8,6 @@ ifneq "$(BootingFromHc)" "YES"
 boot :: all
 endif
 
-ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
-
 ifeq "$(ghc_ge_504)" "NO"
 SRC_HC_OPTS +=  -package lang -package util -package text
 endif
index 2b1ecd9..0cc38b0 100644 (file)
@@ -3,12 +3,10 @@ include $(TOP)/mk/boilerplate.mk
 
 HS_PROG = genprimopcode
 
-ghc_lt_504 = $(shell if (test $(GhcCanonVersion) -lt 504); then echo YES; else echo NO; fi)
-ifeq "$(ghc_lt_504)" "YES"
+ifeq "$(ghc_ge_504)" "NO"
 SRC_HC_OPTS += -package text
 endif
 
-ghc_ge_601 = $(shell if (test $(GhcCanonVersion) -ge 601); then echo YES; else echo NO; fi)
 ifeq "$(ghc_ge_601)" "YES"
 SRC_HC_OPTS += -package parsec
 endif
index c80ec17..809e0a9 100644 (file)
@@ -9,9 +9,6 @@ INSTALLING=1
 # -----------------------------------------------------------------------------
 # ghc-pkg.bin
 
-ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
-ghc_ge_603 = $(shell if (test $(GhcCanonVersion) -ge 603); then echo YES; else echo NO; fi)
-
 SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
 
 SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
index dee4085..3ec18d8 100644 (file)
@@ -21,8 +21,6 @@ ifeq "$(HOSTPLATFORM)" "i386-unknown-cygwinw32"
 HS_PROG           = hsc2hs$(exeext)
 endif
 
-ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
-
 ifeq "$(ghc_ge_504)" "NO"
 SRC_HC_OPTS +=  -package util
 endif