Added xhtml and cgi as default libraries.
[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 html)
29 SUBDIRS += $(wildcard network)
30 SUBDIRS += $(wildcard QuickCheck)
31 SUBDIRS += $(wildcard HUnit)
32 SUBDIRS += $(wildcard mtl)
33 SUBDIRS += $(wildcard fgl)
34 SUBDIRS += $(wildcard X11)
35 SUBDIRS += $(wildcard time)
36 SUBDIRS += $(wildcard HGL)
37 SUBDIRS += $(wildcard OpenGL)
38 SUBDIRS += $(wildcard GLUT)
39 SUBDIRS += $(wildcard OpenAL)
40 SUBDIRS += $(wildcard ALUT)
41 SUBDIRS += $(wildcard stm)
42 SUBDIRS += $(wildcard xhtml)
43 SUBDIRS += $(wildcard cgi)
44 ifeq "$(GhcLibsWithObjectIO)" "YES"
45 SUBDIRS += $(wildcard ObjectIO)
46 endif
47 endif
48
49 # -----------------------------------------------------------------------------
50
51 DIST_CLEAN_FILES += config.cache config.status
52
53 include $(TOP)/mk/target.mk
54
55 # -----------------------------------------------------------------------------
56 # Generating the combined contents/index pages for the library docs
57
58 ifneq "$(NO_HADDOCK_DOCS)" "YES"
59
60 HTML_DIR = html-docs
61
62 # ATTENTION, incomprehensible shell stuff ahead: Automagically create the
63 # prologue for the combined index via a header, the package prologues (in
64 # alphabetical order of the packages) and a footer. Not very nice, but much
65 # better than redundancy or a strong coupling with the packages.
66 libraries.txt: libraries-header.txt libraries-footer.txt $(foreach f,package.conf.in prologue.txt,$(addsuffix /$(f),$(SUBDIRS)))
67         $(RM) $@
68         ( cat libraries-header.txt ; echo ; \
69         for i in `for j in $(SUBDIRS) ; do echo $$j ; done | $(SORT) -f` ; do \
70            if test -f $$i/$$i.haddock; then \
71               echo "[@$$i@]"; \
72               grep -v '^ *$$' $$i/prologue.txt; \
73               echo; \
74            fi; \
75         done ; \
76         cat libraries-footer.txt ; echo ) > $@
77
78 CLEAN_FILES += libraries.txt
79
80 $(HTML_DIR)/index.html : libraries.txt
81         @$(INSTALL_DIR) $(HTML_DIR)
82         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
83                 $(HADDOCK_OPTS) \
84                 -t "Haskell Hierarchical Libraries" \
85                 -p libraries.txt \
86                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
87                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
88                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
89
90 html :: $(HTML_DIR)/index.html
91
92 libraries.HxS : libraries.txt
93         @$(INSTALL_DIR) $(HTML_DIR)
94         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
95                 $(HADDOCK_OPTS) \
96                 -t "Haskell Hierarchical Libraries" \
97                 -p libraries.txt \
98                 -k libraries \
99                 --html-help=mshelp2 \
100                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
101                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
102                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
103         ( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true
104
105 libraries.chm : libraries.txt
106         @$(INSTALL_DIR) $(HTML_DIR)
107         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
108                 $(HADDOCK_OPTS) \
109                 -t "Haskell Hierarchical Libraries" \
110                 -p libraries.txt \
111                 -k libraries \
112                 --html-help=mshelp \
113                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
114                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
115                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
116         ( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true
117
118 HxS :: libraries.HxS
119 chm :: libraries.chm
120
121 install-docs :: $(HTML_DIR)/index.html
122         $(INSTALL_DIR) $(datadir)/html/libraries; \
123         for i in $(HTML_DIR)/*; do \
124                 if test -f $$i; then \
125                   echo $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
126                   $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
127                 fi; \
128         done
129         @for i in $(filter html chm HxS,$(XMLDocWays)); do \
130                 if [ $$i != "html" ]; then \
131                         $(INSTALL_DIR) $(datadir)/doc; \
132                         echo $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
133                         $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
134                 fi; \
135                 if [ $$i = "html-no-chunks" ]; then \
136                         echo $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
137                         $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
138                 fi \
139         done
140 endif # NO_HADDOCK_DOCS