[project @ 2002-04-24 16:13:26 by simonmar]
authorsimonmar <unknown>
Wed, 24 Apr 2002 16:13:26 +0000 (16:13 +0000)
committersimonmar <unknown>
Wed, 24 Apr 2002 16:13:26 +0000 (16:13 +0000)
Makefile rules for building HTML documentation using Haddock.  It's a
bit rough around the edges so far, and I haven't added any actual
documentation yet, but you can build Haddock (in fptools/haddock) and
then say

$ make haddock-docs

in fptools/libraries/base to get bare-bones HTML docs for the entire
contents (almost) of the base package.

Makefile

index 5e62d0c..e57f738 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.23 2002/04/11 12:03:43 simonpj Exp $
+# $Id: Makefile,v 1.24 2002/04/24 16:13:26 simonmar Exp $
 
 TOP=..
 include $(TOP)/mk/boilerplate.mk
@@ -87,6 +87,36 @@ endif # TARGETPLATFORM = i386-unknown-mingw32
 
 
 # -----------------------------------------------------------------------------
+# Doc building with Haddock
+
+EXCLUDED_HADDOCK_SRCS = \
+       GHC/Err.lhs \
+       Data/Generics.hs \
+       GHC/PArr.hs \
+       Control/Monad/Error.hs \
+       Control/Monad/Reader.hs \
+       Control/Monad/State.hs \
+       Control/Monad/Writer.hs
+
+HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS))))
+
+HADDOCK = $(FPTOOLS_TOP)/haddock/src/haddock-inplace
+
+# Urgh, hack needed to ensure that the value of HS_SRCS is computed in time for
+# the docs rule below.
+PRE_SRCS := $(ALL_SRCS)
+
+.PHONY: docs
+haddock-docs : $(HS_PPS)
+       $(HADDOCK) -t "Haskell Core Libraries" -h -s "." $(HS_PPS)
+
+%.raw-hs : %.lhs
+       $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
+
+%.raw-hs : %.hs
+       $(GHC_INPLACE) $(HC_OPTS) -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
+
+# -----------------------------------------------------------------------------
 
 include $(TOP)/mk/target.mk
 
@@ -97,4 +127,3 @@ HSbase.o : $(GHCI_LIBOBJS)
        @touch HSbase.o
 endif # TARGETPLATFORM = i386-unknown-mingw32
 
-