add html package
[ghc-hetmet.git] / libraries / Makefile
1 # -----------------------------------------------------------------------------
2
3 TOP=.
4 include $(TOP)/mk/boilerplate.mk
5
6 # -----------------------------------------------------------------------------
7
8 # The Cabal package has a GNUmakefile for standalone building, but we
9 # want the Makefile.
10 MFLAGS += -f Makefile
11
12 SUBDIRS = base haskell98 template-haskell readline
13
14 ifeq "$(GhcLibsWithUnix)" "YES"
15 SUBDIRS += unix
16 endif
17 ifeq "$(Windows)" "YES"
18 SUBDIRS += $(wildcard Win32)
19 endif
20
21 SUBDIRS += Cabal
22
23 # Set GhcBootLibs=YES from the command line to work with just the libraries
24 # needed to bootstrap GHC.
25 ifneq "$(GhcBootLibs)" "YES"
26 SUBDIRS += $(wildcard parsec)
27 SUBDIRS += $(wildcard haskell-src)
28 SUBDIRS += $(wildcard network)
29 SUBDIRS += $(wildcard QuickCheck)
30 SUBDIRS += $(wildcard HUnit)
31 SUBDIRS += $(wildcard mtl)
32 SUBDIRS += $(wildcard fgl)
33 SUBDIRS += $(wildcard X11)
34 SUBDIRS += $(wildcard time)
35 SUBDIRS += $(wildcard HGL)
36 SUBDIRS += $(wildcard OpenGL)
37 SUBDIRS += $(wildcard GLUT)
38 SUBDIRS += $(wildcard OpenAL)
39 SUBDIRS += $(wildcard ALUT)
40 SUBDIRS += $(wildcard stm)
41 SUBDIRS += $(wildcard html)
42 ifeq "$(GhcLibsWithObjectIO)" "YES"
43 SUBDIRS += $(wildcard ObjectIO)
44 endif
45 endif
46
47 # -----------------------------------------------------------------------------
48
49 DIST_CLEAN_FILES += config.cache config.status
50
51 include $(TOP)/mk/target.mk
52
53 # -----------------------------------------------------------------------------
54 # Generating the combined contents/index pages for the library docs
55
56 ifneq "$(NO_HADDOCK_DOCS)" "YES"
57
58 HTML_DIR = html
59
60 # ATTENTION, incomprehensible shell stuff ahead: Automagically create the
61 # prologue for the combined index via a header, the package prologues (in
62 # alphabetical order of the packages) and a footer. Not very nice, but much
63 # better than redundancy or a strong coupling with the packages.
64 libraries.txt: libraries-header.txt libraries-footer.txt $(foreach f,package.conf.in prologue.txt,$(addsuffix /$(f),$(SUBDIRS)))
65         $(RM) $@
66         ( cat libraries-header.txt ; echo ; \
67         for i in `for j in $(SUBDIRS) ; do echo $$j ; done | $(SORT) -f` ; do \
68            if test -f $$i/$$i.haddock; then \
69               echo "[@$$i@]"; \
70               grep -v '^ *$$' $$i/prologue.txt; \
71               echo; \
72            fi; \
73         done ; \
74         cat libraries-footer.txt ; echo ) > $@
75
76 CLEAN_FILES += libraries.txt
77
78 $(HTML_DIR)/index.html : libraries.txt
79         @$(INSTALL_DIR) $(HTML_DIR)
80         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
81                 $(HADDOCK_OPTS) \
82                 -t "Haskell Hierarchical Libraries" \
83                 -p libraries.txt \
84                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
85                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
86                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
87
88 html :: $(HTML_DIR)/index.html
89
90 libraries.HxS : libraries.txt
91         @$(INSTALL_DIR) $(HTML_DIR)
92         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
93                 $(HADDOCK_OPTS) \
94                 -t "Haskell Hierarchical Libraries" \
95                 -p libraries.txt \
96                 -k libraries \
97                 --html-help=mshelp2 \
98                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
99                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
100                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
101         ( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true
102
103 libraries.chm : libraries.txt
104         @$(INSTALL_DIR) $(HTML_DIR)
105         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
106                 $(HADDOCK_OPTS) \
107                 -t "Haskell Hierarchical Libraries" \
108                 -p libraries.txt \
109                 -k libraries \
110                 --html-help=mshelp \
111                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
112                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
113                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
114         ( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true
115
116 HxS :: libraries.HxS
117 chm :: libraries.chm
118
119 install-docs :: $(HTML_DIR)/index.html
120         $(INSTALL_DIR) $(datadir)/html/libraries; \
121         for i in $(HTML_DIR)/*; do \
122                 if test -f $$i; then \
123                   echo $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
124                   $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
125                 fi; \
126         done
127         @for i in $(filter html chm HxS,$(XMLDocWays)); do \
128                 if [ $$i != "html" ]; then \
129                         $(INSTALL_DIR) $(datadir)/doc; \
130                         echo $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
131                         $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
132                 fi; \
133                 if [ $$i = "html-no-chunks" ]; then \
134                         echo $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
135                         $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
136                 fi \
137         done
138 endif # NO_HADDOCK_DOCS