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