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