fix install_docs dependencies, and add a missing $(INSTALL_DIR)
[ghc-hetmet.git] / ghc.mk
diff --git a/ghc.mk b/ghc.mk
index 94e9080..fbd6955 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -411,7 +411,11 @@ endif
 # Don't try to delete directories:
 .PRECIOUS: %/.
 
-%/. : $(MKDIRHIER)
+# Create build directories on demand.  NB. the | below: this indicates
+# that $(MKDIRHIER) is an order-only dependency, which means that this
+# rule fires after building mkdirhier, but we won't try to recreate
+# directories if mkdirhier changes.
+%/. : | $(MKDIRHIER)
        "$(MKDIRHIER)" $@
 
 # -----------------------------------------------------------------------------
@@ -804,7 +808,7 @@ install_headers: $(INSTALL_HEADERS)
                $(INSTALL_HEADER) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghcheaderdir)"; \
        done
 
-install_docs: $(INSTALL_HEADERS)
+install_docs: $(INSTALL_DOCS) $(INSTALL_LIBRARY_DOCS)
        $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
 ifneq "$(INSTALL_DOCS)" ""
        for i in $(INSTALL_DOCS); do \
@@ -814,9 +818,12 @@ endif
        $(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html"
        $(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html "$(DESTDIR)$(docdir)/html"
 ifneq "$(INSTALL_LIBRARY_DOCS)" ""
+       $(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html/libraries"
        for i in $(INSTALL_LIBRARY_DOCS); do \
                $(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)/html/libraries/"; \
        done
+       $(INSTALL_DATA) $(INSTALL_OPTS) libraries/prologue.txt "$(DESTDIR)$(docdir)/html/libraries/"
+       $(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/"
 endif
 ifneq "$(INSTALL_HTML_DOC_DIRS)" ""
        for i in $(INSTALL_HTML_DOC_DIRS); do \
@@ -866,6 +873,7 @@ install_packages: libffi/package.conf.install rts/package.conf.install
            "$(GHC_CABAL_INPLACE)" install \
                 "$(INSTALLED_GHC_REAL)" \
                 "$(INSTALLED_GHC_PKG_REAL)" \
+                "$(STRIP)" \
                 "$(DESTDIR)$(topdir)" \
                 $p $(INSTALL_DISTDIR_$p) \
                 '$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries' \
@@ -916,6 +924,8 @@ $(eval $(call bindist,.,\
        mk/project.mk \
        mk/install.mk.in \
        bindist.mk \
+       libraries/gen_contents_index \
+       libraries/prologue.txt \
        libraries/dph/LICENSE \
  ))
 endif
@@ -1037,7 +1047,7 @@ sdist-prep :
        $(call sdist_file,utils/haddock,dist,src,Haddock/Interface,Lex,x)
        $(call sdist_file,utils/haddock,dist,src,Haddock/Interface,Parse,y)
        cd $(SRC_DIST_DIR) && "$(RM)" $(RM_OPTS) -r compiler/stage[123] mk/build.mk
-       cd $(SRC_DIST_DIR) && "$(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" -o -name "*-darcs-backup*" \) -print | xargs "$(RM)" $(RM_OPTS) -r
+       cd $(SRC_DIST_DIR) && "$(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" -o -name "*-darcs-backup*" \) -print | "$(XARGS)" $(XARGS_OPTS) "$(RM)" $(RM_OPTS) -r
 
 .PHONY: sdist
 sdist : sdist-prep
@@ -1055,7 +1065,13 @@ publish-sdist :
 endif
 
 ifeq "$(BootingFromHc)" "YES"
-SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
+# In a normal build we use GHC to compile C files (see
+# rules/c-suffix-rules.mk), which passes a number of its own options
+# to the C compiler.  So when bootstrapping we have to provide these
+# flags explicitly to C compilations.
+SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
+SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
+SRC_CC_OPTS += -I$(GHC_INCLUDE_DIR)
 endif
 
 # -----------------------------------------------------------------------------