Add filepath library
[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 filepath 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 extraclean ::
65         $(RM) -rf $(HTML_DIR)
66
67 # ATTENTION, incomprehensible shell stuff ahead: Automagically create the
68 # prologue for the combined index via a header, the package prologues (in
69 # alphabetical order of the packages) and a footer. Not very nice, but much
70 # better than redundancy or a strong coupling with the packages.
71 libraries.txt: libraries-header.txt libraries-footer.txt $(foreach f,package.conf.in prologue.txt,$(addsuffix /$(f),$(SUBDIRS)))
72         $(RM) $@
73         ( cat libraries-header.txt ; echo ; \
74         for i in `for j in $(SUBDIRS) ; do echo $$j ; done | $(SORT) -f` ; do \
75            if test -f $$i/$$i.haddock; then \
76               echo "[@$$i@]"; \
77               grep -v '^ *$$' $$i/prologue.txt; \
78               echo; \
79            fi; \
80         done ; \
81         cat libraries-footer.txt ; echo ) > $@
82
83 CLEAN_FILES += libraries.txt
84
85 $(HTML_DIR)/index.html : libraries.txt
86         @$(INSTALL_DIR) $(HTML_DIR)
87         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
88                 $(HADDOCK_OPTS) \
89                 -t "Haskell Hierarchical Libraries" \
90                 -p libraries.txt \
91                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
92                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
93                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
94
95 html :: $(HTML_DIR)/index.html
96
97 libraries.HxS : libraries.txt
98         @$(INSTALL_DIR) $(HTML_DIR)
99         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
100                 $(HADDOCK_OPTS) \
101                 -t "Haskell Hierarchical Libraries" \
102                 -p libraries.txt \
103                 -k libraries \
104                 --html-help=mshelp2 \
105                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
106                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
107                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
108         ( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true
109
110 libraries.chm : libraries.txt
111         @$(INSTALL_DIR) $(HTML_DIR)
112         $(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
113                 $(HADDOCK_OPTS) \
114                 -t "Haskell Hierarchical Libraries" \
115                 -p libraries.txt \
116                 -k libraries \
117                 --html-help=mshelp \
118                 $(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
119                    $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
120                       --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
121         ( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true
122
123 HxS :: libraries.HxS
124 chm :: libraries.chm
125
126 install-docs :: $(HTML_DIR)/index.html
127         $(INSTALL_DIR) $(datadir)/html/libraries; \
128         for i in $(HTML_DIR)/*; do \
129                 if test -f $$i; then \
130                   echo $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
131                   $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
132                 fi; \
133         done
134         @for i in $(filter html chm HxS,$(XMLDocWays)); do \
135                 if [ $$i != "html" ]; then \
136                         $(INSTALL_DIR) $(datadir)/doc; \
137                         echo $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
138                         $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
139                 fi; \
140                 if [ $$i = "html-no-chunks" ]; then \
141                         echo $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
142                         $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
143                 fi \
144         done
145 endif # NO_HADDOCK_DOCS