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