Commit 88aa9117 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Fix where all the documentation gets installed

The paths can also now be overridden with the standard configure flags
--docdir=, --htmldir= etc. We were always advertising these, but now we
actually obey them.
parent bf9eb20f
......@@ -6,7 +6,7 @@ SUBDIRS = man docbook-cheat-sheet ext-core storage-mgt users_guide
PAGES = index.html
install-docs :: $(PAGES)
$(INSTALL_DIR) $(datadir)/html
$(INSTALL_DATA) $(INSTALL_OPTS) $(PAGES) $(datadir)/html
$(INSTALL_DIR) $(htmldir)
$(INSTALL_DATA) $(INSTALL_OPTS) $(PAGES) $(htmldir)
include $(TOP)/mk/target.mk
......@@ -20,7 +20,7 @@
<UL>
<LI>
<P>
<B><A HREF="users_guide/index.html">The User's Guide</A></B>
<B><A HREF="users_guide/html/index.html">The User's Guide</A></B>
</P>
<P>
The User's Guide has all you need to know about using GHC:
......@@ -30,7 +30,7 @@
<LI>
<P>
<B><A HREF="libraries/index.html">Libraries</A></B>
<B><A HREF="libraries/html/index.html">Libraries</A></B>
</P>
<P>
Documentation for the libraries that come with GHC.
......@@ -39,7 +39,7 @@
<LI>
<P>
<B><A HREF="Cabal/index.html">Cabal</A></B>
<B><A HREF="Cabal/html/index.html">Cabal</A></B>
</P>
<P>An infrastructure for building and distributing Haskell
software.</P>
......@@ -54,3 +54,4 @@
</ul>
</BODY>
</HTML>
......@@ -186,24 +186,22 @@ configure: $(foreach SUBDIR,$(SUBDIRS), \
# We should depend on %/%.cabal here (and in other rules), but make
# makes that difficult.
# We explicitly set datadir to "$prefix/share" as, while that is the
# default on Linux, on Windows it defaults to
# "C:\\Program Files\\Common Files"
# We explicitly set datadir to a sensible value, as Cabal (used to?) use
# "C:\\Program Files\\Common Files"
# on Windows
# We also set libsubdir differently on Windows and non-Windows, as on
# non-Windows the path we deduce is highre up than the path passed to
# non-Windows the path we deduce is higher up than the path passed to
# the executable with the shell script on non-Windows. This should
# probably be tidied up so that we can always pass the same libsubdir.
ifeq "$(Windows)" "YES"
DATA_REL_DIR = .
datadir = $$prefix
libsubdir = $$pkgid
datadir = $$prefix
libsubdir = $$pkgid
else
DATA_REL_DIR = share/ghc
datadir = $$prefix/share/ghc
libsubdir = $$compiler/lib/$$pkgid
datadir = $$prefix/share/ghc
libsubdir = $$compiler/lib/$$pkgid
endif
DOC_ROOT = $(prefix)/$(DATA_REL_DIR)/doc/html/
libraryhtmldir = $(htmldir)/libraries
# We rely on all the CONFIGURE_ARGS being quoted with '...', and there
# being no 's inside the values.
......@@ -219,8 +217,9 @@ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: %/setup/Setup
$(CONFIGURE_OPTS) \
--prefix='$$topdir' \
--datadir='$(datadir)' \
--datasubdir='.' \
--datasubdir='$$pkgid' \
--libsubdir='$(libsubdir)' \
--docdir='$(libraryhtmldir)' \
--with-compiler=../../compiler/stage1/ghc-inplace$ \
--with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace$ \
--with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace \
......@@ -266,8 +265,6 @@ $(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/GNUmakefile):\
.PHONY: doc
DOC_SUBDIRS = $(filter-out haskell98,$(SUBDIRS))
doc: $(foreach SUBDIR,$(SUBDIRS),doc.library.$(SUBDIR))
sh gen_contents_index
......@@ -303,13 +300,13 @@ endif
install: $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR))
ifeq "$(HADDOCK_DOCS)" "YES"
$(INSTALL_DIR) $(DOC_ROOT)
$(INSTALL_DATA) index.html doc-index.html $(DOC_ROOT)
$(INSTALL_SCRIPT) gen_contents_index $(DOC_ROOT)
$(INSTALL_DIR) $(libraryhtmldir)/html
$(INSTALL_DATA) index.html doc-index.html $(libraryhtmldir)/html
$(INSTALL_SCRIPT) gen_contents_index $(libraryhtmldir)/html
# Hacks:
$(INSTALL_DATA) $(DOC_ROOT)/base/*.css $(DOC_ROOT)
$(INSTALL_DATA) $(DOC_ROOT)/base/*.js $(DOC_ROOT)
$(INSTALL_DATA) $(DOC_ROOT)/base/*.gif $(DOC_ROOT)
$(INSTALL_DATA) $(libraryhtmldir)/html/base/*.css $(libraryhtmldir)/html
$(INSTALL_DATA) $(libraryhtmldir)/html/base/*.js $(libraryhtmldir)/html
$(INSTALL_DATA) $(libraryhtmldir)/html/base/*.gif $(libraryhtmldir)/html
endif
# Cabal doesn't let us ask to install docs only, so do nothing here
......
......@@ -504,6 +504,9 @@ FPTOOLS_TOP_ABS = @hardtop@
# The platform specific version of 'hardtop'.
FPTOOLS_TOP_ABS_PLATFORM = @hardtop_plat@
# This gets used in the default docdir
PACKAGE_TARNAME = @PACKAGE_TARNAME@
BIN_DIST_NAME=ghc-$(ProjectVersion)
BIN_DIST_TOPDIR=$(FPTOOLS_TOP_ABS)
BIN_DIST_DIR=$(BIN_DIST_TOPDIR)/$(BIN_DIST_NAME)
......@@ -547,6 +550,11 @@ datadir = $(datadir0)/ghc-$(ProjectVersion)
endif # Windows
headerdir = $(libdir)/include
docdir = @docdir@
htmldir = @htmldir@
dvidir = @dvidir@
pdfdir = @pdfdir@
psdir = @psdir@
# Default place for putting interface files is $(libdir)
# (overriden for packages in package.mk)
......
......@@ -278,27 +278,27 @@ install-docs:: $(INSTALL_DOCS)
endif
endif
# TODO: The following could be an entry for an Obfuscated Makefile Contest...
ifneq "$(strip $(INSTALL_XML_DOC))" ""
ifneq "$(XMLDocWays)" ""
# TODO: The following could be an entry for an Obfuscated Makefile Contest...
install-docs:: $(foreach i,$(XMLDocWays),$(INSTALL_XML_DOC)$(patsubst %.html-no-chunks,%.html,$(patsubst %.html,%/index.html,.$(i))))
$(INSTALL_DIR) $(DESTDIR)$(datadir)
for i in $(XMLDocWays); do \
if [ $$i = "html" ]; then \
$(INSTALL_DIR) $(DESTDIR)$(datadir)/html; \
$(INSTALL_DIR) $(DESTDIR)$(datadir)/html/$(INSTALL_XML_DOC); \
echo "( cd $(INSTALL_XML_DOC) && $(CP) * $(DESTDIR)$(datadir)/html/$(INSTALL_XML_DOC) )" ; \
( cd $(INSTALL_XML_DOC) && $(CP) * $(DESTDIR)$(datadir)/html/$(INSTALL_XML_DOC) ) ; \
else \
$(INSTALL_DIR) $(DESTDIR)$(datadir)/doc; \
echo $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(DESTDIR)$(datadir)/doc; \
$(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(DESTDIR)$(datadir)/doc; \
fi; \
if [ $$i = "html-no-chunks" ]; then \
echo $(CP) $(FPTOOLS_CSS_ABS) $(DESTDIR)$(datadir)/doc; \
$(CP) $(FPTOOLS_CSS_ABS) $(DESTDIR)$(datadir)/doc; \
fi \
done
install-docs:: $(foreach i,$(XMLDocWays),install-docs-$i)
install-docs-html:
$(INSTALL_DIR) $(DESTDIR)$(htmldir)
$(INSTALL_DIR) $(DESTDIR)$(htmldir)/$(INSTALL_XML_DOC)
$(INSTALL_DIR) $(DESTDIR)$(htmldir)/$(INSTALL_XML_DOC)/html
$(CP) $(INSTALL_XML_DOC)/* $(DESTDIR)$(htmldir)/$(INSTALL_XML_DOC)/html
install-docs-html-no-chunks:
$(INSTALL_DIR) $(DESTDIR)$(htmldir)
$(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC).html $(DESTDIR)$(htmldir)
$(CP) $(FPTOOLS_CSS_ABS) $(DESTDIR)$(htmldir)
install-docs-%:
$(INSTALL_DIR) $(DESTDIR)$($*dir)
$(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)$* $(DESTDIR)$($*dir)
endif
endif
......
......@@ -303,7 +303,7 @@ CLEAN_FILES += $(PACKAGE).haddock
%.raw-hs : %.hs
$(HC) $(HC_OPTS) -D__HADDOCK__ -E $< -o $@
HTML_INSTALL_DIR = $(datadir)/html/libraries/$(PACKAGE)
HTML_INSTALL_DIR = $(htmldir)/libraries/html/$(PACKAGE)
install-docs :: $(HTML_DOC)
@$(INSTALL_DIR) $(HTML_INSTALL_DIR)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment