Add Note [No alternatives lint check]
[ghc.git] / ghc.mk
diff --git a/ghc.mk b/ghc.mk
index fb93ef0..18ead9c 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -359,7 +359,7 @@ endif
 # Packages to build
 # The lists of packages that we *actually* going to build in each stage:
 #
-#  $(PACKAGES_STAGE0) 
+#  $(PACKAGES_STAGE0)
 #  $(PACKAGES_STAGE1)
 #  $(PACKAGES_STAGE2)
 #
@@ -383,7 +383,7 @@ else
 # programs such as GHC and ghc-pkg, that we do not assume the stage0
 # compiler already has installed (or up-to-date enough).
 
-PACKAGES_STAGE0 = Cabal/Cabal hpc binary bin-package-db hoopl transformers
+PACKAGES_STAGE0 = binary Cabal/Cabal hpc bin-package-db hoopl transformers
 ifeq "$(Windows_Host)" "NO"
 ifneq "$(HostOS_CPP)" "ios"
 PACKAGES_STAGE0 += terminfo
@@ -398,7 +398,6 @@ PACKAGES_STAGE1 += array
 PACKAGES_STAGE1 += deepseq
 PACKAGES_STAGE1 += bytestring
 PACKAGES_STAGE1 += containers
-PACKAGES_STAGE1 += old-locale
 
 ifeq "$(Windows_Host)" "YES"
 PACKAGES_STAGE1 += Win32
@@ -413,19 +412,16 @@ PACKAGES_STAGE1 += process
 PACKAGES_STAGE1 += hpc
 PACKAGES_STAGE1 += pretty
 PACKAGES_STAGE1 += template-haskell
-PACKAGES_STAGE1 += Cabal/Cabal
 PACKAGES_STAGE1 += binary
+PACKAGES_STAGE1 += Cabal/Cabal
 PACKAGES_STAGE1 += bin-package-db
 PACKAGES_STAGE1 += hoopl
 PACKAGES_STAGE1 += transformers
 
-ifneq "$(CrossCompiling)" "YES"
-PACKAGES_STAGE2 += old-time
-PACKAGES_STAGE2 += haskell98
-PACKAGES_STAGE2 += haskell2010
+ifeq "$(HADDOCK_DOCS)" "YES"
+PACKAGES_STAGE1 += xhtml
 endif
 
-PACKAGES_STAGE1 += xhtml
 ifeq "$(Windows_Target)" "NO"
 ifneq "$(TargetOS_CPP)" "ios"
 PACKAGES_STAGE1 += terminfo
@@ -590,7 +586,9 @@ libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-ins
 
 ifneq "$(CLEANING)" "YES"
 ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
-libraries/base_dist-install_CONFIGURE_OPTS += --flags=-integer-simple
+libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-gmp
+else ifeq "$(INTEGER_LIBRARY)" "integer-gmp2"
+libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-gmp2
 else ifeq "$(INTEGER_LIBRARY)" "integer-simple"
 libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-simple
 else
@@ -630,7 +628,7 @@ BUILD_DIRS += includes
 BUILD_DIRS += rts
 
 ifneq "$(BINDIST)" "YES"
-BUILD_DIRS += bindisttest 
+BUILD_DIRS += bindisttest
 BUILD_DIRS += utils/genapply
 endif
 
@@ -657,8 +655,17 @@ BUILD_DIRS += libraries/integer-gmp/gmp
 BUILD_DIRS += libraries/integer-gmp/mkGmpDerivedConstants
 endif
 
+ifeq "$(INTEGER_LIBRARY)" "integer-gmp2"
+BUILD_DIRS += libraries/integer-gmp2/gmp
+else ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
+BUILD_DIRS += libraries/integer-gmp2/gmp
+endif
+
+ifeq "$(HADDOCK_DOCS)" "YES"
 BUILD_DIRS += utils/haddock
 BUILD_DIRS += utils/haddock/doc
+endif
+
 BUILD_DIRS += compiler
 BUILD_DIRS += utils/hsc2hs
 BUILD_DIRS += utils/ghc-pkg
@@ -696,10 +703,10 @@ stage1_libs : $(ALL_STAGE1_LIBS)
 
 # ----------------------------------------------
 # Per-package compiler flags
-# 
-# If you want to add per-package compiler flags, this 
+#
+# If you want to add per-package compiler flags, this
 # is the place to do it.  Do it like this for package <pkg>
-#   
+#
 #   libraries/<pkg>_dist-boot_HC_OPTS += -Wwarn
 #   libraries/<pkg>_dist-install_HC_OPTS += -Wwarn
 
@@ -719,7 +726,7 @@ ifneq "$(BINDIST)" "YES"
 
 ifneq "$(BOOTSTRAPPING_CONF)" ""
 ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" ""
-$(shell echo "[]" >$(BOOTSTRAPPING_CONF))
+$(shell $(GHC_PKG) init $(BOOTSTRAPPING_CONF))
 endif
 endif
 
@@ -1101,14 +1108,31 @@ SRC_DIST_GHC_DIRS = mk rules docs distrib bindisttest libffi includes \
     utils docs rts compiler ghc driver libraries libffi-tarballs
 SRC_DIST_GHC_FILES += \
     configure.ac config.guess config.sub configure \
-    aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \
-    settings.in VERSION \
-    boot packages ghc.mk
-
-VERSION :
-       echo $(ProjectVersion) >VERSION
-
-sdist : VERSION
+    aclocal.m4 README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \
+    install-sh settings.in VERSION GIT_COMMIT_ID \
+    boot packages ghc.mk MAKEHELP.md
+
+.PHONY: VERSION
+VERSION:
+       @if test -f $@ && test "`cat $@`" = "$(ProjectVersion)"; \
+       then echo "$@ needs no update"; \
+       else echo "update $@ ($(ProjectVersion))"; echo "$(ProjectVersion)" > $@; fi
+
+.PHONY: GIT_COMMIT_ID
+GIT_COMMIT_ID:
+       @if test -d .git && test "`git rev-parse HEAD`" != "$(ProjectGitCommitId)"; then \
+          echo "******************************************************************************"; \
+          echo "Stale ProjectGitCommitId (=$(ProjectGitCommitId)) detected!"; \
+           echo "'git rev-parse HEAD' says: `git rev-parse HEAD`"; \
+          echo "Please re-run './configure' before creating source-distribution"; \
+          echo "******************************************************************************"; \
+          exit 1; \
+       fi
+       @if test -f $@ && test "`cat $@`" = "$(ProjectGitCommitId)"; \
+       then echo "$@ needs no update"; \
+       else echo "update $@ ($(ProjectGitCommitId))"; echo -n "$(ProjectGitCommitId)" > $@; fi
+
+sdist-ghc-prep : VERSION GIT_COMMIT_ID
 
 # Use:
 #     $(call sdist_ghc_file,compiler,stage2,cmm,Foo/Bar,CmmLex,x)
@@ -1126,10 +1150,10 @@ EXTRA_PACKAGES=parallel stm random primitive vector dph
 sdist-ghc-prep :
        $(call removeTrees,$(SRC_DIST_GHC_ROOT))
        $(call removeFiles,$(SRC_DIST_GHC_TARBALL))
-       -mkdir $(SRC_DIST_ROOT)
-       mkdir $(SRC_DIST_GHC_ROOT)
-       mkdir $(SRC_DIST_GHC_DIR)
-       cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_DIRS); do mkdir $$i; ( cd $$i && lndir $(TOP)/$$i ); done
+       mkdir -p $(SRC_DIST_ROOT)
+       mkdir -p $(SRC_DIST_GHC_ROOT)
+       mkdir -p $(SRC_DIST_GHC_DIR)
+       cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_DIRS); do mkdir -p $$i; ( cd $$i && lndir $(TOP)/$$i ); done
        cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_FILES); do $(LN_S) $(TOP)/$$i .; done
        cd $(SRC_DIST_GHC_DIR) && $(MAKE) distclean
        $(call removeTrees,$(SRC_DIST_GHC_DIR)/libraries/tarballs/)
@@ -1140,7 +1164,7 @@ sdist-ghc-prep :
        $(call sdist_ghc_file,compiler,stage2,cmm,,CmmLex,x)
        $(call sdist_ghc_file,compiler,stage2,cmm,,CmmParse,y)
        $(call sdist_ghc_file,compiler,stage2,parser,,Lexer,x)
-       $(call sdist_ghc_file,compiler,stage2,parser,,Parser,y.pp)
+       $(call sdist_ghc_file,compiler,stage2,parser,,Parser,y)
        $(call sdist_ghc_file,utils/hpc,dist-install,,,HpcParser,y)
        $(call sdist_ghc_file,utils/genprimopcode,dist,,,Lexer,x)
        $(call sdist_ghc_file,utils/genprimopcode,dist,,,Parser,y)
@@ -1150,10 +1174,10 @@ sdist-ghc-prep :
 sdist-windows-tarballs-prep :
        $(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_ROOT))
        $(call removeFiles,$(SRC_DIST_WINDOWS_TARBALLS_TARBALL))
-       -mkdir $(SRC_DIST_ROOT)
-       mkdir $(SRC_DIST_WINDOWS_TARBALLS_ROOT)
-       mkdir $(SRC_DIST_WINDOWS_TARBALLS_DIR)
-       mkdir $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs
+       mkdir -p $(SRC_DIST_ROOT)
+       mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_ROOT)
+       mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)
+       mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs
        cd $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs && lndir $(TOP)/ghc-tarballs
        $(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs/.git)
 
@@ -1161,10 +1185,10 @@ sdist-windows-tarballs-prep :
 sdist-testsuite-prep :
        $(call removeTrees,$(SRC_DIST_TESTSUITE_ROOT))
        $(call removeFiles,$(SRC_DIST_TESTSUITE_TARBALL))
-       -mkdir $(SRC_DIST_ROOT)
-       mkdir $(SRC_DIST_TESTSUITE_ROOT)
-       mkdir $(SRC_DIST_TESTSUITE_DIR)
-       mkdir $(SRC_DIST_TESTSUITE_DIR)/testsuite
+       mkdir -p $(SRC_DIST_ROOT)
+       mkdir -p $(SRC_DIST_TESTSUITE_ROOT)
+       mkdir -p $(SRC_DIST_TESTSUITE_DIR)
+       mkdir -p $(SRC_DIST_TESTSUITE_DIR)/testsuite
        cd $(SRC_DIST_TESTSUITE_DIR)/testsuite && lndir $(TOP)/testsuite
 
 .PHONY: sdist-ghc
@@ -1209,9 +1233,9 @@ sdist_%:
 
 .PHONY: clean
 
-CLEAN_FILES += libraries/bootstrapping.conf
 CLEAN_FILES += libraries/integer-gmp/cbits/GmpDerivedConstants.h
 CLEAN_FILES += libraries/integer-gmp/include/HsIntegerGmp.h
+CLEAN_FILES += libraries/integer-gmp2/include/HsIntegerGmp.h
 CLEAN_FILES += libraries/base/include/EventConfig.h
 CLEAN_FILES += mk/config.mk.old
 CLEAN_FILES += mk/project.mk.old
@@ -1223,8 +1247,8 @@ CLEAN_FILES += includes/GHCConstants.h
 CLEAN_FILES += includes/DerivedConstants.h
 CLEAN_FILES += includes/ghcautoconf.h
 CLEAN_FILES += includes/ghcplatform.h
+CLEAN_FILES += includes/ghcversion.h
 CLEAN_FILES += utils/ghc-pkg/Version.hs
-CLEAN_FILES += compiler/parser/Parser.y
 CLEAN_FILES += compiler/prelude/primops.txt
 CLEAN_FILES += $(wildcard compiler/primop*incl)
 
@@ -1237,6 +1261,7 @@ clean_files :
        $(call removeTrees,includes/dist-derivedconstants)
        $(call removeTrees,inplace/bin)
        $(call removeTrees,inplace/lib)
+       $(call removeTrees,libraries/bootstrapping.conf)
 
 .PHONY: clean_libraries
 clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
@@ -1309,7 +1334,6 @@ distclean : clean
        $(call removeFiles,libraries/process/include/HsProcessConfig.h)
        $(call removeFiles,libraries/unix/include/HsUnixConfig.h)
        $(call removeFiles,libraries/time/include/HsTimeConfig.h)
-       $(call removeFiles,libraries/old-time/include/HsTimeConfig.h)
 
 # The library configure scripts also like creating autom4te.cache
 # directories, so clean them all up.
@@ -1338,7 +1362,6 @@ maintainer-clean : distclean
        $(call removeFiles,libraries/process/include/HsProcessConfig.h.in)
        $(call removeFiles,libraries/unix/include/HsUnixConfig.h.in)
        $(call removeFiles,libraries/time/include/HsTimeConfig.h.in)
-       $(call removeFiles,libraries/old-time/include/HsTimeConfig.h.in)
 
 .PHONY: all_libraries