5b42a41504377531922cdb82c2c20ed1143e77a1
[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: haskell.pdf html
11
12 # Begin by saying
13 # touch haskell.idx
14
15
16 #########################################
17 # Tools you need
18 #########################################
19
20 # Stuf from the tools/directory
21 RUN_TEX = ../tools/run_tex
22 RUN_INDEX = ../tools/run_index
23 VERBATIM = ../tools/verbatim
24 VERB_TEX4HT = ../tools/verb-tex4ht
25
26 # splitAndIndexPgm won't work unless you have "perl"
27 SPLITPGM = perl ../tools/splitAndIndexPgm
28
29 RM = rm -f
30 CP = cp
31 LN = ln -sf
32 LATEX = latex
33 PDFLATEX = pdflatex
34 BIBTEX = bibtex
35 MAKEINDEX = makeindex
36
37 # 'expand' expands tabs to spaces
38 # On my machine the windows program (which does something
39 # quite different) shadows it. Sigh.
40 EXPAND = expand
41 # EXPAND = c:/cygwin/bin/expand
42
43
44 #########################################
45 # Files
46 #########################################
47
48 RELEASE_DIR = ../haskell-prime-draft
49 JFP_DIR = ../jfp-release
50
51 PARTS = haskell.tex preface.tex $(PARTS_NO_PREFACE)
52 PARTS_NO_PREFACE = iso-chars.tex \
53 intro.tex lexemes.tex exps.tex \
54 decls.tex modules.tex basic.tex io-13.tex \
55 derived.tex \
56 index-extra.tex index-intro.tex layout.tex fixity.tex \
57 literate.tex pragmas.tex standard-prelude.tex \
58 ratio.tex complex.tex ix.tex \
59 numeric.tex \
60 array.tex io.tex char.tex monad.tex list.tex \
61 system.tex directory.tex \
62 maybe.tex time.tex cputime.tex random.tex \
63 locale.tex syntax-lexical.tex syntax-iso.tex ffi.tex \
64 Prelude.tex PreludeList.tex PreludeText.tex PreludeIO.tex \
65 lib-marshal.tex \
66 lib-cerror.tex lib-data-intword.tex lib-marshalerror.tex \
67 lib-cforeign.tex lib-foreignptr.tex lib-marshalutils.tex \
68 lib-cstring.tex lib-foreign.tex lib-ptr.tex \
69 lib-ctypes.tex lib-marshalalloc.tex lib-stableptr.tex \
70 lib-data-bits.tex lib-marshalarray.tex lib-storable.tex
71
72 CODE = lib-code/Ratio.tex lib-code/Complex.tex lib-code/Ix.tex \
73 lib-code/Numeric.tex \
74 lib-code/Array.tex lib-code/Char.tex lib-code/List.tex \
75 lib-code/Monad.tex lib-code/Maybe.tex lib-code/IO.tex \
76 lib-code/Time.tex lib-code/Locale.tex
77
78 HEADERS = lib-hdrs/Ratio.tex lib-hdrs/Complex.tex lib-hdrs/Ix.tex \
79 lib-hdrs/Numeric.tex \
80 lib-hdrs/Array.tex lib-hdrs/IO.tex lib-hdrs/Char.tex \
81 lib-hdrs/List.tex lib-hdrs/List1.tex \
82 lib-hdrs/Monad.tex lib-hdrs/System.tex lib-hdrs/Directory.tex \
83 lib-hdrs/Maybe.tex lib-hdrs/IO1.tex lib-hdrs/Random.tex \
84 lib-hdrs/Time.tex lib-hdrs/Time1.tex lib-hdrs/CPUTime.tex \
85 lib-hdrs/Locale.tex
86
87 HT_TEXS = $(patsubst %, ht/%, $(PARTS))
88
89 #########################################
90 # Main targets
91 #########################################
92
93 # The normally formatted report -- 2 sided, one-up
94 # haskell.verb: plain_haskell.verb
95 # -cp plain_haskell.verb haskell.verb
96
97 haskell.tex: haskell.verb
98 $(EXPAND) < $< | $(VERBATIM) >$@
99
100 # I have no idea why run_tex is run twice. SLPJ
101 # html: index.html ${PARTS}
102 # -mkdir haskell-report-html
103 # $(RUN_TEX)
104 # $(RUN_TEX)
105 # $(RUN_INDEX)
106 # cp index.html *.png *.gif haskell-report-html
107
108 haskell.dvi: haskell.tex haskell.ind ${PARTS} ${CODE} ${HEADERS}
109 haskell.pdf: haskell.tex haskell.ind ${PARTS} ${CODE} ${HEADERS}
110
111 haskell.ps : haskell.dvi
112 dvips haskell.dvi -o haskell.ps
113
114 # Can't use pdflatex because of eps inclusion
115
116 release: haskell.ps html
117 if ! test -d $(RELEASE_DIR); then mkdir $(RELEASE_DIR); fi
118 ps2pdf haskell.ps
119 gzip < haskell.ps > $(RELEASE_DIR)/haskell.ps.gz
120 cp haskell.pdf $(RELEASE_DIR)/haskell.pdf
121 cp -r haskell-report-html $(RELEASE_DIR)
122 tar cvf - haskell-report-html | gzip > $(RELEASE_DIR)/haskell-report-html.tar.gz
123 cp *.png *.gif $(RELEASE_DIR)
124 #cp h98-revised.html $(RELEASE_DIR)/index.html
125 #cp haskell98-bugs.html h98.gif $(RELEASE_DIR)
126 #cp haskell98-revised-bugs.html h98.gif $(RELEASE_DIR)
127
128 publish-pdf: report.pdf
129 gzip < report.pdf > y:Haskell/haskell-report/report.pdf.gz
130
131 #########################################
132 # HTML
133 #########################################
134
135 ht/classes.eps : classes.eps
136 $(CP) $< $@
137
138 ht/lib-hdrs :
139 $(RM) $@
140 $(LN) ../lib-hdrs ht/lib-hdrs
141
142 ht/lib-code :
143 $(RM) $@
144 $(LN) ../lib-code ht/lib-code
145
146 html: $(HT_TEXS) ht/classes.eps ht/lib-hdrs ht/lib-code
147 cd ht && htlatex haskell.tex "haskell,2"
148
149 #########################################
150 # Generic stuff
151 #########################################
152
153 veryclean: clean
154 $(RM) *~
155
156 clean:
157 $(RM) ht/*.tex ht/*.html
158 $(RM) *.dvi *.log *.aux *.ilg *.blg *.toc ${PARTS} \
159 haskell.tex haskell.ps haskell.pdf *.o lex.yy.c haskell-report-html/*
160
161
162 #########################################
163 # Suffix rules
164 #########################################
165
166 %.tex: %.verb
167 $(EXPAND) < $< | $(VERBATIM) | sh ../tools/subsection >$@
168 # The 'subsection' part changes section -> chapter for the book style
169
170 %.verb: %.hs
171 $(EXPAND) < $< | $(SPLITPGM) >$@
172
173 %.tex: %.hs
174 $(EXPAND) < $< | $(SPLITPGM) | $(VERBATIM) >$@
175
176 %.tex: %.hi
177 $(EXPAND) < $< | $(SPLITPGM) | $(VERBATIM) >$@
178
179 %.dvi: %.tex
180 $(LATEX) $<
181
182 %.pdf: %.tex
183 $(PDFLATEX) $<
184 $(BIBTEX) $*
185 $(MAKEINDEX) -i -t haskell.ilg < haskell.idx > haskell.ind
186 $(PDFLATEX) $<
187 $(PDFLATEX) $<
188
189 ht/%.tex: %.verb
190 $(EXPAND) < $< | $(VERB_TEX4HT) | sh ../tools/subsection >$@
191
192 jfp: h98-book.tex preface-jfp.tex ${PARTS_NO_PREFACE}
193 -mkdir $(JFP_DIR)
194 for n in h98-book.tex preface-jfp.tex \
195 ${PARTS_NO_PREFACE}; do \
196 ../tools/subsection < $$n > $(JFP_DIR)/$$n ; done
197 cp classes.eps $(JFP_DIR)
198 cp haskell.bbl $(JFP_DIR)/h98-book.bbl
199 cp Makefile-jfp-book $(JFP_DIR)/Makefile
200
201
202
203
204 # Stuff to make the "two-up" version for SIGPLAN Notices:
205 # We take the A4 pages and double them up onto (virtual) A3 pages:
206 # (two A5 pages make one A4 page; two A4 pages make one A3 page; ...)
207 #
208 # % dvidvi '2:0,1(210mm,0)' haskell.dvi > haskell-2up.dvi
209 #
210 # We now print the "A3" pages in landscape, but "magnify" them by
211 # 1 / sqrt(2) ~ 0.7071; this should make our "A4" pages print in an
212 # A4 space: presto! 2up printing!
213 # (except that I've tried to make it give us 1" margins all round
214 # when we print on US 8.5"x11" paper)
215 #
216 # % dvips -t landscape -x 707 haskell-2up.dvi > haskell-2up.ps
217 #
218 # if your "dvips" is set up properly, it will run Metafont for you,
219 # creating just-right magnifications for all the fonts.
220 #
221 # print with: lpr -Pmy-laserwriter haskell-2up.ps
222
223 # These rules keep failing for me (segmentation fault on haskell-2up.dvi)
224 # The output seems fine, though, and the individual commands work
225 # perfectly(!). More network wierdness? KH
226
227 haskell-2up.ps : haskell-2up.dvi
228 dvips -t landscape -x 707 haskell-2up.dvi > haskell-2up.ps
229
230 haskell-2up.dvi : haskellx.dvi
231 -dvidvi '2:0(0in,0in),1(160mm,0in)' haskellx.dvi > haskell-2up.dvi
232
233 haskellx.dvi : sigplan_haskell.dvi
234 dviselect =4: haskell.dvi haskellx.dvi
235
236 haskell-libraries-2up.ps : haskell-libraries-2up.dvi
237 dvips -t landscape -x 707 haskell-libraries-2up.dvi > haskell-libraries-2up.ps
238
239 haskell-libraries-2up.dvi : haskell-librariesx.dvi
240 -dvidvi '2:0(0in,0in),1(160mm,0in)' haskell-librariesx.dvi > haskell-libraries-2up.dvi
241
242 haskell-librariesx.dvi : sigplan_haskell-libraries.dvi
243 dviselect =4: sigplan_haskell-libraries.dvi haskell-librariesx.dvi
244