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