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