switch to new Haddock-generated library docs
[haskell-report.git] / report / Makefile
1 # Makefile for the Haskell Report
2 # read the README file before you start!
3 #
4 # Target 'jfp' copies stuff into $(JFP_DIR) for the JFP book
5 # you need to do the same in the libraries directory
6
7 ##########################################
8 # What to make if you type 'make'
9
10 default: pdf html
11
12 .PHONY: pdf
13 pdf : haskell.pdf
14
15 # Begin by saying
16 # touch haskell.idx
17
18 #########################################
19 # Tools you need
20 #########################################
21
22 # Stuf from the tools/directory
23 RUN_TEX = ../tools/run_tex
24 RUN_INDEX = ../tools/run_index
25 VERBATIM = ../tools/verbatim
26 VERB_TEX4HT = ../tools/verb-tex4ht
27
28 # splitAndIndexPgm won't work unless you have "perl"
29 SPLITPGM = perl ../tools/splitAndIndexPgm
30
31 RM = rm -f
32 CP = cp
33 LN = ln -sf
34 LATEX = latex
35 PDFLATEX = pdflatex
36 BIBTEX = bibtex
37 MAKEINDEX = makeindex
38
39 # 'expand' expands tabs to spaces
40 # On my machine the windows program (which does something
41 # quite different) shadows it. Sigh.
42 EXPAND = expand
43 # EXPAND = c:/cygwin/bin/expand
44
45
46 #########################################
47 # Files
48 #########################################
49
50 RELEASE_DIR = ../haskell-prime-draft
51 JFP_DIR = ../jfp-release
52
53 PARTS = haskell.tex preface.tex $(PARTS_NO_PREFACE)
54 PARTS_NO_PREFACE = iso-chars.tex \
55 intro.tex lexemes.tex exps.tex \
56 decls.tex modules.tex basic.tex io-13.tex \
57 derived.tex \
58 index-extra.tex index-intro.tex layout.tex fixity.tex \
59 literate.tex pragmas.tex standard-prelude.tex \
60 syntax-lexical.tex syntax-iso.tex ffi.tex \
61 Prelude.tex PreludeList.tex PreludeText.tex PreludeIO.tex \
62 $(LIB_TEX)
63
64 LIB_MODULES = Data.Array \
65 Data.Char \
66 Data.Complex \
67 System.IO \
68 System.IO.Error \
69 Data.Ix \
70 Data.List \
71 Data.Maybe \
72 Control.Monad \
73 Data.Ratio \
74 System.Environment \
75 System.Exit \
76 Data.Int \
77 Data.Word \
78 Data.Bits \
79 Foreign \
80 Foreign.Ptr \
81 Foreign.ForeignPtr \
82 Foreign.StablePtr \
83 Foreign.Storable \
84 Foreign.C \
85 Foreign.C.Error \
86 Foreign.C.String \
87 Foreign.C.Types \
88 Foreign.Marshal \
89 Foreign.Marshal.Alloc \
90 Foreign.Marshal.Array \
91 Foreign.Marshal.Error \
92 Foreign.Marshal.Utils
93
94 HADDOCK_ODIR = libs
95
96 LIB_TEX = $(patsubst %, $(HADDOCK_ODIR)/%, $(addsuffix .tex, $(subst .,-,$(LIB_MODULES))))
97
98 HT_TEXS = $(patsubst %, ht/%, $(PARTS))
99
100 show:
101 @echo '$(VALUE)="$($(VALUE))"'
102
103 #########################################
104 # Main targets
105 #########################################
106
107 # The normally formatted report -- 2 sided, one-up
108 # haskell.verb: plain_haskell.verb
109 # -cp plain_haskell.verb haskell.verb
110
111 haskell.tex: haskell.verb
112 $(EXPAND) < $< | $(VERBATIM) >$@
113
114 # I have no idea why run_tex is run twice. SLPJ
115 # html: index.html ${PARTS}
116 # -mkdir haskell-report-html
117 # $(RUN_TEX)
118 # $(RUN_TEX)
119 # $(RUN_INDEX)
120 # cp index.html *.png *.gif haskell-report-html
121
122 haskell.dvi: haskell.tex haskell.ind ${PARTS}
123 haskell.pdf: haskell.tex haskell.ind haddock-style.tex ${PARTS}
124
125 haskell.ps : haskell.dvi
126 dvips haskell.dvi -o haskell.ps
127
128 # Can't use pdflatex because of eps inclusion
129
130 release: haskell.ps html
131 if ! test -d $(RELEASE_DIR); then mkdir $(RELEASE_DIR); fi
132 ps2pdf haskell.ps
133 gzip < haskell.ps > $(RELEASE_DIR)/haskell.ps.gz
134 cp haskell.pdf $(RELEASE_DIR)/haskell.pdf
135 cp -r haskell-report-html $(RELEASE_DIR)
136 tar cvf - haskell-report-html | gzip > $(RELEASE_DIR)/haskell-report-html.tar.gz
137 cp *.png *.gif $(RELEASE_DIR)
138 #cp h98-revised.html $(RELEASE_DIR)/index.html
139 #cp haskell98-bugs.html h98.gif $(RELEASE_DIR)
140 #cp haskell98-revised-bugs.html h98.gif $(RELEASE_DIR)
141
142 publish-pdf: report.pdf
143 gzip < report.pdf > y:Haskell/haskell-report/report.pdf.gz
144
145 #########################################
146 # HTML
147 #########################################
148
149 ht/classes.eps : classes.eps
150 $(CP) $< $@
151
152 .PHONY: html
153 html: $(HT_TEXS) ht/classes.eps ht/haddock-style.tex
154 cd ht && htlatex haskell.tex "haskell,2"
155
156 #########################################
157 # Generic stuff
158 #########################################
159
160 .PHONY: clean veryclean
161 veryclean: clean
162 $(RM) *~
163
164 clean:
165 $(RM) ht/*.tex ht/*.html
166 $(RM) *.dvi *.log *.aux *.ilg *.blg *.toc ${PARTS} \
167 haskell.tex haskell.ps haskell.pdf *.o lex.yy.c haskell-report-html/*
168
169
170 #########################################
171 # Suffix rules
172 #########################################
173
174 %.tex: %.verb
175 $(EXPAND) < $< | $(VERBATIM) | sh ../tools/subsection >$@
176 # The 'subsection' part changes section -> chapter for the book style
177
178 %.verb: %.hs
179 $(EXPAND) < $< | $(SPLITPGM) >$@
180
181 %.tex: %.hs
182 $(EXPAND) < $< | $(SPLITPGM) | $(VERBATIM) >$@
183
184 %.tex: %.hi
185 $(EXPAND) < $< | $(SPLITPGM) | $(VERBATIM) >$@
186
187 %.dvi: %.tex
188 $(LATEX) $<
189
190 %.pdf: %.tex
191 $(PDFLATEX) $<
192 $(BIBTEX) $*
193 $(MAKEINDEX) -i -t haskell.ilg < haskell.idx > haskell.ind
194 $(PDFLATEX) $<
195 $(PDFLATEX) $<
196
197 ht/%.tex: %.verb
198 $(EXPAND) < $< | $(VERB_TEX4HT) | sh ../tools/subsection >$@
199
200 ht/libs/%.tex: libs/%.tex
201 $(CP) $< $@
202
203 jfp: h98-book.tex preface-jfp.tex ${PARTS_NO_PREFACE}
204 -mkdir $(JFP_DIR)
205 for n in h98-book.tex preface-jfp.tex \
206 ${PARTS_NO_PREFACE}; do \
207 ../tools/subsection < $$n > $(JFP_DIR)/$$n ; done
208 cp classes.eps $(JFP_DIR)
209 cp haskell.bbl $(JFP_DIR)/h98-book.bbl
210 cp Makefile-jfp-book $(JFP_DIR)/Makefile
211
212
213
214
215 # Stuff to make the "two-up" version for SIGPLAN Notices:
216 # We take the A4 pages and double them up onto (virtual) A3 pages:
217 # (two A5 pages make one A4 page; two A4 pages make one A3 page; ...)
218 #
219 # % dvidvi '2:0,1(210mm,0)' haskell.dvi > haskell-2up.dvi
220 #
221 # We now print the "A3" pages in landscape, but "magnify" them by
222 # 1 / sqrt(2) ~ 0.7071; this should make our "A4" pages print in an
223 # A4 space: presto! 2up printing!
224 # (except that I've tried to make it give us 1" margins all round
225 # when we print on US 8.5"x11" paper)
226 #
227 # % dvips -t landscape -x 707 haskell-2up.dvi > haskell-2up.ps
228 #
229 # if your "dvips" is set up properly, it will run Metafont for you,
230 # creating just-right magnifications for all the fonts.
231 #
232 # print with: lpr -Pmy-laserwriter haskell-2up.ps
233
234 # These rules keep failing for me (segmentation fault on haskell-2up.dvi)
235 # The output seems fine, though, and the individual commands work
236 # perfectly(!). More network wierdness? KH
237
238 haskell-2up.ps : haskell-2up.dvi
239 dvips -t landscape -x 707 haskell-2up.dvi > haskell-2up.ps
240
241 haskell-2up.dvi : haskellx.dvi
242 -dvidvi '2:0(0in,0in),1(160mm,0in)' haskellx.dvi > haskell-2up.dvi
243
244 haskellx.dvi : sigplan_haskell.dvi
245 dviselect =4: haskell.dvi haskellx.dvi
246
247 haskell-libraries-2up.ps : haskell-libraries-2up.dvi
248 dvips -t landscape -x 707 haskell-libraries-2up.dvi > haskell-libraries-2up.ps
249
250 haskell-libraries-2up.dvi : haskell-librariesx.dvi
251 -dvidvi '2:0(0in,0in),1(160mm,0in)' haskell-librariesx.dvi > haskell-libraries-2up.dvi
252
253 haskell-librariesx.dvi : sigplan_haskell-libraries.dvi
254 dviselect =4: sigplan_haskell-libraries.dvi haskell-librariesx.dvi
255
256
257 # -----------------------------------------------------------------------------
258 # Haddock-generated library docs
259
260 HADDOCK = /64playpen/simonmar/testing/inplace/bin/haddock
261
262 GHC_BUILD = /home/simonmar/builds/testing
263 LIB_PKG_DIR = $(GHC_BUILD)/libraries/haskell2010
264
265 HADDOCK_GHC_OPTS = --optghc=-package-name --optghc=haskell2010-1.0.0.0 --optghc=-hide-all-packages --optghc=-i --optghc=-i$(GHC_BUILD)/libraries/haskell2010/. --optghc=-i$(GHC_BUILD)/libraries/haskell2010/dist-install/build --optghc=-i$(GHC_BUILD)/libraries/haskell2010/dist-install/build/autogen --optghc=-i$(GHC_BUILD)/Libraries/haskell2010/dist-install/build --optghc=-i$(GHC_BUILD)/Libraries/haskell2010/dist-install/build/autogen --optghc=-i$(GHC_BUILD)/Libraries/haskell2010/. --optghc=-optP-include --optghc=-optP$(GHC_BUILD)/libraries/haskell2010/dist-install/build/autogen/cabal_macros.h --optghc=-package --optghc=array-0.3.0.0 --optghc=-package --optghc=base-4.3.0.0 --optghc=-package-name --optghc=haskell2010 --optghc=-XPackageImports --optghc=-XCPP --optghc=-no-user-package-conf --optghc=-rtsopts --optghc=-O --optghc=-fasm --optghc=-dcore-lint --optghc=-fno-warn-deprecated-flags --optghc=-odir --optghc=libraries/haskell2010/dist-install/build --optghc=-hidir --optghc=$(GHC_BUILD)/libraries/haskell2010/dist-install/build --optghc=-stubdir --optghc=$(GHC_BUILD)/libraries/haskell2010/dist-install/build --optghc=-hisuf --optghc=hi --optghc=-osuf --optghc=o --optghc=-hcsuf --optghc=hc
266
267 haddock :
268 $(HADDOCK) --odir=$(HADDOCK_ODIR) --no-tmp-comp-dir --latex --title="haskell2010-1.0.0.0: Compatibility with Haskell 2010" --read-interface=../ghc-prim,$(GHC_BUILD)/libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock --read-interface=../array-0.3.0.0,$(GHC_BUILD)/libraries/array/dist-install/doc/html/array/array.haddock --read-interface=../base-4.3.0.0,$(GHC_BUILD)/libraries/base/dist-install/doc/html/base/base.haddock $(HADDOCK_GHC_OPTS) $(patsubst %, $(LIB_PKG_DIR)/%, $(addsuffix .hs, $(subst .,/,$(LIB_MODULES))))