autodetect BINDIST_DOC_WAYS again
[ghc-hetmet.git] / Makefile
index e00a844..bedad7f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -223,10 +223,6 @@ BinDistLinks = ghc ghci ghc-pkg
 BinDistLibSplicedFiles = package.conf
 BinDistDirs = includes compiler docs driver rts utils
 
-BIN_DIST_NAME=ghc-$(ProjectVersion)
-BIN_DIST_TOPDIR=$(FPTOOLS_TOP_ABS)
-BIN_DIST_DIR=$(BIN_DIST_TOPDIR)/$(BIN_DIST_NAME)
-
 BIN_DIST_TARBALL=ghc-$(ProjectVersion)-$(TARGETPLATFORM).tar.bz2
 
 BIN_DIST_TOP= distrib/Makefile \
@@ -299,26 +295,32 @@ binary-dist::
 # binary dist'ing the documentation.  
 # The default documentation to build/install is given below; overrideable
 # via build.mk or the 'make' command-line.
+#
+# If BINDIST_DOC_WAYS is set, use that
+# If XMLDocWays is set, use that
+# Otherwise, figure out what we can build based on configure results
 
 ifndef BINDIST_DOC_WAYS
 
+ifneq "$(XMLDocWays)" ""
 BINDIST_DOC_WAYS = $(XMLDocWays)
-
-# ifneq "$(XSLTPROC)" ""
-# BINDIST_DOC_WAYS = html
-# ifneq "$(FOP)" ""
-# BINDIST_DOC_WAYS += ps pdf
-# else
-# ifneq "$(PDFXMLTEX)" ""
-# BINDIST_DOC_WAYS += pdf
-# endif
-# ifneq "$(XMLTEX)" ""
-# ifneq "$(DVIPS)" ""
-# BINDIST_DOC_WAYS += ps
-# endif # DVIPS
-# endif # XMLTEX
-# endif # FOP
-# endif # XSLTPROC
+else
+ifneq "$(XSLTPROC)" ""
+BINDIST_DOC_WAYS = html
+ifneq "$(FOP)" ""
+BINDIST_DOC_WAYS += ps pdf
+else
+ifneq "$(PDFXMLTEX)" ""
+BINDIST_DOC_WAYS += pdf
+endif
+ifneq "$(XMLTEX)" ""
+ifneq "$(DVIPS)" ""
+BINDIST_DOC_WAYS += ps
+endif # DVIPS
+endif # XMLTEX
+endif # FOP
+endif # XSLTPROC
+endif # XMLDocWays
 
 endif # BINDIST_DOC_WAYS
 
@@ -332,6 +334,7 @@ binary-dist :: $(BINARY_DIST_DOC_RULES)
 $(BINARY_DIST_DOC_RULES): binary-dist-doc-%:
        $(MAKE) -C $* $(MFLAGS) $(BINDIST_DOC_WAYS)
        $(MAKE) -C $* $(MFLAGS) install-docs \
+                       MAKING_BIN_DIST=1 \
                XMLDocWays="$(BINDIST_DOC_WAYS)" \
                prefix=$(BIN_DIST_DIR) \
                exec_prefix=$(BIN_DIST_DIR) \
@@ -372,27 +375,8 @@ endif
 
 .PHONY: binary-dist-doc-%
 
-BIN_DIST_LIBDIR=$(BIN_DIST_DIR)/libraries
-
-LIBRARY_SUBDIRS=$(shell $(MAKE) -s -C libraries subdirs)
-
-BINARY_DIST_LIBRARY_RULES=$(foreach d,$(LIBRARY_SUBDIRS),binary-dist-lib-$d)
-
-binary-dist:: $(BINARY_DIST_LIBRARY_RULES)
-       cp    libraries/Makefile           $(BIN_DIST_LIBDIR)
-       cp    libraries/gen_contents_index $(BIN_DIST_LIBDIR)
-       cp    libraries/index.html         $(BIN_DIST_LIBDIR)
-       cp    libraries/doc-index.html     $(BIN_DIST_LIBDIR)
-       cp -a libraries/stamp              $(BIN_DIST_LIBDIR)
-
-$(BINARY_DIST_LIBRARY_RULES): binary-dist-lib-%:
-       $(MKDIRHIER) $(BIN_DIST_LIBDIR)/$*/setup
-       cp    libraries/$*/setup/Setup   $(BIN_DIST_LIBDIR)/$*/setup
-       cp    libraries/$*/*.cabal       $(BIN_DIST_LIBDIR)/$*
-       cp -a libraries/$*/dist          $(BIN_DIST_LIBDIR)/$*
-       find $(BIN_DIST_LIBDIR)/$*/dist \
-            \( \( -name "*.o" -o -name "*.p_o" \) -a \! -name "HS*" \) \
-            -exec rm {} \;
+binary-dist::
+       $(MAKE) -C libraries binary-dist
 
 # Jiggle the files around to make a valid Windows distribution if necessary
 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
@@ -418,8 +402,8 @@ endif
 .PHONY: publish-binary-dist
 publish-binary-dist :
        @for i in 0 1 2 3 4 5 6 7 8 9; do \
-               echo "Try $$i: $(PublishCp) $(BIN_DIST_TARBALL) $(PublishLocation)"; \
-               if $(PublishCp) $(BIN_DIST_TARBALL) $(PublishLocation); then break; fi\
+               echo "Try $$i: $(PublishCp) $(BIN_DIST_TARBALL) $(PublishLocation)/dist"; \
+               if $(PublishCp) $(BIN_DIST_TARBALL) $(PublishLocation)/dist; then break; fi; \
        done
        $(PublishCp) -r $(BIN_DIST_DIR)/share/html/* $(PublishLocation)/docs