Add ASSERTs to all calls of nameModule
[ghc-hetmet.git] / Makefile
index 471ac1a..e71fe18 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -72,18 +72,9 @@ else
 SUBDIRS_BUILD = includes utils driver docs compiler libraries/Cabal/doc
 endif
 
-SUBDIRS = gmp libffi includes utils driver docs rts compiler ghc libraries libraries/Cabal/doc
+SUBDIRS = gmp libffi includes utils docs rts compiler ghc driver libraries libraries/Cabal/doc
 
-check-all: check-tools check-packages
-
-check-tools:
-       @:
-ifeq "$(HADDOCK_DOCS)" "YES"
-ifeq "$(HADDOCK)"      ""
-       echo "Couldn't find haddock" >&2
-       exit 1
-endif
-endif
+check-all: check-packages
 
 # Sanity check that all the boot libraries are in the tree, to catch
 # failure to run darcs-all.
@@ -134,7 +125,6 @@ stage1 : $(GCC_LIB_DEP) check-all
        $(MAKE) -C rts boot
        $(MAKE) -C rts
        $(MAKE) -C libraries all
-       $(MAKE) -C utils with-stage-1
 
 # When making distributions (i.e., whether with binary-dist or using the 
 # vanilla install target to create an installer package), we can have problems
@@ -146,8 +136,10 @@ stage1 : $(GCC_LIB_DEP) check-all
 stage2 : check-all
        $(MAKE) -C compiler stage=2 boot
        $(MAKE) -C compiler stage=2
+       $(MAKE) -C utils with-stage-2
 ifeq "$(HADDOCK_DOCS)" "YES"
-       $(MAKE) -C compiler stage=2 doc
+       $(MAKE) -C libraries doc
+       $(MAKE) -C compiler  doc stage=2
 endif
 
 stage3 : check-all
@@ -284,7 +276,7 @@ install-docs ::
 
 binary-dist::
        -rm -rf $(BIN_DIST_DIR)
-       -$(RM) $(BIN_DIST_TARBALL)
+       -$(RM) $(BIN_DIST_TAR_BZ2)
 
 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
 
@@ -304,8 +296,8 @@ binary-dist :: tar-binary-dist
 
 .PHONY: tar-binary-dist
 tar-binary-dist:
-       ( cd $(BIN_DIST_TOPDIR_ABS); tar cf - $(BIN_DIST_NAME) | bzip2 > $(BIN_DIST_TARBALL) )
-       ( cd $(BIN_DIST_TOPDIR_ABS); bunzip2 -c $(BIN_DIST_TARBALL) | tar tf - | sed "s/^ghc-$(ProjectVersion)/fptools/" | sort >$(FPTOOLS_TOP_ABS)/bin-manifest-$(ProjectVersion) )
+       ( cd $(BIN_DIST_TOPDIR_ABS); $(TAR) cf - $(BIN_DIST_NAME) | bzip2 > $(BIN_DIST_TAR_BZ2) )
+       ( cd $(BIN_DIST_TOPDIR_ABS); bunzip2 -c $(BIN_DIST_TAR_BZ2) | $(TAR) tf - | sed "s/^ghc-$(ProjectVersion)/fptools/" | sort >$(FPTOOLS_TOP_ABS)/bin-manifest-$(ProjectVersion) )
 
 else
 
@@ -344,6 +336,7 @@ binary-dist::
        $(MAKE) -C driver              binary-dist WHERE_AM_I=$(WHERE_AM_I)/driver
        $(MAKE) -C utils               binary-dist WHERE_AM_I=$(WHERE_AM_I)/utils
        $(MAKE) -C docs                binary-dist WHERE_AM_I=$(WHERE_AM_I)/docs
+       $(MAKE) -C libffi              binary-dist WHERE_AM_I=$(WHERE_AM_I)/libffi
        $(MAKE) -C libraries           binary-dist WHERE_AM_I=$(WHERE_AM_I)/libraries
        $(MAKE) -C libraries/Cabal/doc binary-dist WHERE_AM_I=$(WHERE_AM_I)/libraries/Cabal/doc
 # Now thinks get messier. Some files we need to move around, rename or
@@ -390,6 +383,7 @@ endif
        echo "XSLTPROC = $(XSLTPROC)"                     >> $(BIN_DIST_VARFILE)
        echo "TARGETPLATFORM = $(TARGETPLATFORM)"         >> $(BIN_DIST_VARFILE)
        echo "HADDOCK_DOCS = $(HADDOCK_DOCS)"             >> $(BIN_DIST_VARFILE)
+       echo "LATEX_DOCS = $(LATEX_DOCS)"                 >> $(BIN_DIST_VARFILE)
        echo "INTEGER_LIBRARY = $(INTEGER_LIBRARY)"       >> $(BIN_DIST_VARFILE)
        cat distrib/Makefile-bin-vars.in                  >> $(BIN_DIST_VARFILE)
 
@@ -399,13 +393,13 @@ endif
        ln -s . $(BIN_DIST_NAME)
 # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
 # tree then we want to include the real file, not a symlink to it
-       tar hcf $(BIN_DIST_TAR) -T $(BIN_DIST_LIST)
-       cd $(BIN_DIST_PREP_DIR) && tar rf $(BIN_DIST_TAR) $(BIN_DIST_NAME)
+       $(TAR) hcf $(BIN_DIST_TAR) -T $(BIN_DIST_LIST)
+       cd $(BIN_DIST_PREP_DIR) && $(TAR) rf $(BIN_DIST_TAR) $(BIN_DIST_NAME)
        bzip2 < $(BIN_DIST_TAR) > $(BIN_DIST_TAR_BZ2)
-       tar tf $(BIN_DIST_TAR) | sort > bin-manifest-$(ProjectVersion)
+       $(TAR) tf $(BIN_DIST_TAR) | sort > bin-manifest-$(ProjectVersion)
 endif
 
-PUBLISH_FILES = $(BIN_DIST_TARBALL)
+PUBLISH_FILES = $(BIN_DIST_TAR_BZ2)
 
 # Upload the distribution and documentation
 ifneq "$(ISCC)" ""
@@ -468,7 +462,7 @@ binary-dist::
 
 ifeq "$(darwin_TARGET_OS)" "1"
 
-.PHONY: framework-pkg, framework-binary-dist
+.PHONY: framework-pkg framework-binary-dist
 
 framework-pkg:
        $(MAKE) -C distrib/MacOS framework-pkg
@@ -519,7 +513,7 @@ SRC_DIST_FILES += \
 #   - remove a bunch of other files that we know shouldn't be in the dist
 #   - tar up first the extralibs package, then the main source package
 
-EXTRA_LIBS=$(patsubst %, $(SRC_DIST_NAME)/libraries/%, $(shell cat libraries/extra-packages))
+EXTRA_LIBS=$(patsubst %, $(SRC_DIST_NAME)/%, $(shell grep -E "extralibs|dph" packages | grep -v "^\#" | sed "s/ .*//"))
 
 SRC_DIST_TARBALL = ghc-$(ProjectVersion)-src.tar.bz2
 SRC_DIST_EXTRALIBS_TARBALL = ghc-$(ProjectVersion)-src-extralibs.tar.bz2
@@ -529,6 +523,24 @@ VERSION :
 
 dist :: VERSION
 
+# Use:
+#     $(call copy_generated_compiler_file,cmm,CmmLex,x)
+# to copy the generated file that replaces compiler/cmm/CmmLex.x
+# XXX Should this be unconditional? Do we want to support making a src dist
+# from an unbuilt tree?
+copy_generated_compiler_file = \
+  if test -f $(FPTOOLS_TOP_ABS)/compiler/dist-stage2/build/$2.hs; \
+  then \
+    $(CP) $(FPTOOLS_TOP_ABS)/compiler/dist-stage2/build/$2.hs compiler/$1/ ; \
+    mv compiler/$1/$2.$3 compiler/$1/$2.$3.source ; \
+  fi
+copy_generated_util_file = \
+  if test -f $(FPTOOLS_TOP_ABS)/utils/$1/dist-install/build/$1/$1-tmp/$2.hs; \
+  then \
+    $(CP) $(FPTOOLS_TOP_ABS)/utils/$1/dist-install/build/$1/$1-tmp/$2.hs utils/$1/ ; \
+    mv utils/$1/$2.$3 utils/$1/$2.$3.source ; \
+  fi
+
 dist ::
        $(RM) -rf $(SRC_DIST_DIR)
        $(RM) $(SRC_DIST_NAME).tar.gz
@@ -538,12 +550,21 @@ dist ::
          && for i in $(SRC_DIST_FILES); do $(LN_S) $(FPTOOLS_TOP_ABS)/$$i .; done \
          && $(MAKE) distclean \
          && if test -f $(FPTOOLS_TOP_ABS)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs; then $(CP) $(FPTOOLS_TOP_ABS)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs libraries/haskell-src/Language/Haskell/ ; mv libraries/haskell-src/Language/Haskell/Parser.ly libraries/haskell-src/Language/Haskell/Parser.ly.source ; fi \
+         && $(call copy_generated_compiler_file,cmm,CmmLex,x) \
+         && $(call copy_generated_compiler_file,cmm,CmmParse,y) \
+         && $(call copy_generated_compiler_file,main,ParsePkgConf,y) \
+         && $(call copy_generated_compiler_file,parser,HaddockLex,x) \
+         && $(call copy_generated_compiler_file,parser,HaddockParse,y) \
+         && $(call copy_generated_compiler_file,parser,Lexer,x) \
+         && $(call copy_generated_compiler_file,parser,Parser,y.pp) \
+         && $(call copy_generated_compiler_file,parser,ParserCore,y) \
+         && $(call copy_generated_util_file,hpc,HpcParser,y) \
          && $(RM) -rf compiler/stage[123] mk/build.mk \
          && $(FIND) $(SRC_DIST_DIRS) \( -name _darcs -o -name SRC -o -name "autom4te*" -o -name "*~" -o -name ".cvsignore" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" \) -print | xargs $(RM) -rf \
        )
-       tar chf - $(EXTRA_LIBS) | bzip2 >$(FPTOOLS_TOP_ABS)/$(SRC_DIST_EXTRALIBS_TARBALL)
+       $(TAR) chf - $(EXTRA_LIBS) | bzip2 >$(FPTOOLS_TOP_ABS)/$(SRC_DIST_EXTRALIBS_TARBALL)
        $(RM) -rf $(EXTRA_LIBS)
-       tar chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(FPTOOLS_TOP_ABS)/$(SRC_DIST_TARBALL)
+       $(TAR) chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(FPTOOLS_TOP_ABS)/$(SRC_DIST_TARBALL)
 
 # Upload the distribution(s)
 # Retrying is to work around buggy firewalls that corrupt large file transfers
@@ -571,7 +592,7 @@ hc-file-bundle :
             ghc-$(ProjectVersion)/libraries -follow \
          \( -name "*.hc" -o -name "*_hsc.[ch]" -o -name "*_stub.[ch]" \) -print > hc-files-to-go
        for f in `$(FIND) ghc-$(ProjectVersion)/compiler ghc-$(ProjectVersion)/utils ghc-$(ProjectVersion)/libraries -name "*.hsc" -follow -print` ""; do \
-            if test "x$$f" != "x" && test -e `echo "$$f" | sed 's/hsc$$/hs/g'`; then \
+            if test "x$$f" != "x" && test -f `echo "$$f" | sed 's/hsc$$/hs/g'`; then \
                echo `echo "$$f" | sed 's/hsc$$/hs/g' ` >> hc-files-to-go ; \
             fi; \
        done;
@@ -585,7 +606,7 @@ hc-file-bundle :
        echo ghc-$(ProjectVersion)/compiler/parser/ParserCore.hs >> hc-files-to-go
        echo ghc-$(ProjectVersion)/compiler/main/ParsePkgConf.hs >> hc-files-to-go
        echo ghc-$(ProjectVersion)/libraries/haskell-src/Language/Haskell/Parser.hs >> hc-files-to-go
-       tar czf ghc-$(ProjectVersion)-$(TARGETPLATFORM)-hc.tar.gz `cat hc-files-to-go`
+       $(TAR) czf ghc-$(ProjectVersion)-$(TARGETPLATFORM)-hc.tar.gz `cat hc-files-to-go`
 
 # -----------------------------------------------------------------------------
 # Cleaning