Makefile 4.65 KB
Newer Older
1
2
3
4
5
6
7
# -----------------------------------------------------------------------------

TOP=.
include $(TOP)/mk/boilerplate.mk

# -----------------------------------------------------------------------------

Simon Marlow's avatar
Simon Marlow committed
8
9
10
11
# The Cabal package has a GNUmakefile for standalone building, but we
# want the Makefile.
MFLAGS += -f Makefile

12
13
SUBDIRS = base haskell98 template-haskell readline \
	  regex-base regex-posix regex-compat parsec Cabal
14
15
16
17

ifeq "$(GhcLibsWithUnix)" "YES"
SUBDIRS += unix
endif
18
19
20
ifeq "$(Windows)" "YES"
SUBDIRS += $(wildcard Win32)
endif
21
22
23
24
25

# Set GhcBootLibs=YES from the command line to work with just the libraries
# needed to bootstrap GHC.
ifneq "$(GhcBootLibs)" "YES"
SUBDIRS += $(wildcard haskell-src)
26
SUBDIRS += $(wildcard html)
27
28
29
30
31
32
SUBDIRS += $(wildcard network)
SUBDIRS += $(wildcard QuickCheck)
SUBDIRS += $(wildcard HUnit)
SUBDIRS += $(wildcard mtl)
SUBDIRS += $(wildcard fgl)
SUBDIRS += $(wildcard X11)
33
SUBDIRS += $(wildcard time)
Simon Marlow's avatar
Simon Marlow committed
34
35
36
ifeq "$(Windows)" "NO"
# HGL is not working on Win32, so omit it for now.  Better not to ship it
# at all than to ship a broken version.
37
SUBDIRS += $(wildcard HGL)
Simon Marlow's avatar
Simon Marlow committed
38
endif
39
40
41
42
43
SUBDIRS += $(wildcard OpenGL)
SUBDIRS += $(wildcard GLUT)
SUBDIRS += $(wildcard OpenAL)
SUBDIRS += $(wildcard ALUT)
SUBDIRS += $(wildcard stm)
44
45
SUBDIRS += $(wildcard xhtml)
SUBDIRS += $(wildcard cgi)
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
ifeq "$(GhcLibsWithObjectIO)" "YES"
SUBDIRS += $(wildcard ObjectIO)
endif
endif

# -----------------------------------------------------------------------------

DIST_CLEAN_FILES += config.cache config.status

include $(TOP)/mk/target.mk

# -----------------------------------------------------------------------------
# Generating the combined contents/index pages for the library docs

ifneq "$(NO_HADDOCK_DOCS)" "YES"

62
HTML_DIR = html-docs
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

# ATTENTION, incomprehensible shell stuff ahead: Automagically create the
# prologue for the combined index via a header, the package prologues (in
# alphabetical order of the packages) and a footer. Not very nice, but much
# better than redundancy or a strong coupling with the packages.
libraries.txt: libraries-header.txt libraries-footer.txt $(foreach f,package.conf.in prologue.txt,$(addsuffix /$(f),$(SUBDIRS)))
	$(RM) $@
	( cat libraries-header.txt ; echo ; \
	for i in `for j in $(SUBDIRS) ; do echo $$j ; done | $(SORT) -f` ; do \
	   if test -f $$i/$$i.haddock; then \
	      echo "[@$$i@]"; \
	      grep -v '^ *$$' $$i/prologue.txt; \
	      echo; \
	   fi; \
	done ; \
	cat libraries-footer.txt ; echo ) > $@

CLEAN_FILES += libraries.txt

$(HTML_DIR)/index.html : libraries.txt
	@$(INSTALL_DIR) $(HTML_DIR)
	$(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
		$(HADDOCK_OPTS) \
		-t "Haskell Hierarchical Libraries" \
		-p libraries.txt \
		$(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
		   $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
		      --read-interface=$(pkg),$(pkg)/$(pkg).haddock))

html :: $(HTML_DIR)/index.html

libraries.HxS : libraries.txt
	@$(INSTALL_DIR) $(HTML_DIR)
	$(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
		$(HADDOCK_OPTS) \
		-t "Haskell Hierarchical Libraries" \
		-p libraries.txt \
		-k libraries \
		--html-help=mshelp2 \
		$(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
		   $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
		      --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
	( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true

libraries.chm : libraries.txt
	@$(INSTALL_DIR) $(HTML_DIR)
	$(HADDOCK) --gen-index --gen-contents -o $(HTML_DIR) \
		$(HADDOCK_OPTS) \
		-t "Haskell Hierarchical Libraries" \
		-p libraries.txt \
		-k libraries \
		--html-help=mshelp \
		$(foreach pkg, $(filter-out haskell98,$(SUBDIRS)), \
		   $(foreach p, $(wildcard $(pkg)/$(pkg).haddock), \
		      --read-interface=$(pkg),$(pkg)/$(pkg).haddock))
	( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true

HxS :: libraries.HxS
chm :: libraries.chm

install-docs :: $(HTML_DIR)/index.html
	$(INSTALL_DIR) $(datadir)/html/libraries; \
	for i in $(HTML_DIR)/*; do \
		if test -f $$i; then \
		  echo $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
		  $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/libraries; \
		fi; \
	done
	@for i in $(filter html chm HxS,$(XMLDocWays)); do \
		if [ $$i != "html" ]; then \
			$(INSTALL_DIR) $(datadir)/doc; \
			echo $(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
			$(INSTALL_DATA) $(INSTALL_OPTS) libraries`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
		fi; \
		if [ $$i = "html-no-chunks" ]; then \
			echo $(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
			$(CP) $(FPTOOLS_CSS_ABS) $(datadir); \
		fi \
	done
endif # NO_HADDOCK_DOCS