-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile.lit
123 lines (100 loc) · 2.74 KB
/
Makefile.lit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
%-------------------------------= --------------------------------------------
\section{Makefile}
%-------------------------------= --------------------------------------------
Abbreviations for directories and files.
%
\begin{code}
binpath := $(HOME)/bin
sources := Main.lhs TeXCommands.lhs TeXParser.lhs \
Typewriter.lhs Math.lhs\
Directives.lhs HsLexer.lhs \
Parser.lhs FiniteMap.lhs Auxiliaries.lhs \
StateT.lhs Document.lhs Verbatim.lhs Value.lhs
snips := sorts.tt sorts.math id.math cata.math spec.math
objects := $(foreach file, $(sources:.lhs=.o), $(file))
sections := $(foreach file, $(sources:.lhs=.tex), $(file))
\end{code}
\hrulefill
The dependencies generated by |make depend|.
%
\begin{code}
include lhs2TeX.d
\end{code}
\hrulefill
Abbreviations for commands.
%
\begin{code}
ghc := ghc
ghcflags := -W -O -recomp -H32M
\end{code}
\hrulefill
Static pattern rules and pattern rules.
%
\begin{code}
$(objects) : %.o : %.lhs
$(ghc) -c $(ghcflags) $< -o $@
%.hi : %.o
@if [ ! -f $@ ] ; then \
echo $(RM) $< ; \
$(RM) $< ; \
set +e ; \
echo $(MAKE) $(notdir $<) ; \
$(MAKE) $(notdir $<) ; \
if [ $$? -ne 0 ] ; then \
exit 1; \
fi ; \
fi
%.tex : %.lhs lhs2TeX Lhs2TeX.fmt
# lhs2TeX -verb -iLhs2TeX.fmt $< > $@
lhs2TeX -math -align 33 -iLhs2TeX.fmt $< > $@
%.tt : %.snip lhs2TeX lhs2TeX.fmt
lhs2TeX -tt -lmeta=True -ilhs2TeX.fmt $< > $@
%.math : %.snip lhs2TeX lhs2TeX.fmt
lhs2TeX -math -align 33 -lmeta=True -ilhs2TeX.fmt $< > $@
%.tex : %.lit lhs2TeX
lhs2TeX -verb -ilhs2TeX.fmt $< > $@
%.ps : %.dvi
dvips -D600 -o $@ $<
\end{code}
\hrulefill
Finally the different targets.
%
\begin{code}
.PHONY: depend show view print install backup clean
Makefile: Makefile.lit
lhs2TeX -code Makefile.lit > Makefile
lhs2TeX.sty: lhs2TeX.sty.lit
lhs2TeX -code lhs2TeX.sty.lit > lhs2TeX.sty
lhs2TeX.fmt: lhs2TeX.fmt.lit
lhs2TeX -code lhs2TeX.fmt.lit > lhs2TeX.fmt
lhs2TeX : $(objects)
$(ghc) $(ghcflags) -o lhs2TeX $(objects)
depend:
mkdependHS -f lhs2TeX.d -- $(ghcflags) -- $(sources)
rm -f lhs2TeX.d.bak
Lhs2TeX.dvi : Lhs2TeX.tex lhs2TeX.sty $(sections) $(snips) lhs2TeX.sty.tex lhs2TeX.fmt.tex Makefile.tex
latex Lhs2TeX
# latex Lhs2TeX
show : Lhs2TeX.dvi
xdvi -s 3 Lhs2TeX.dvi &
view : Lhs2TeX.ps
xe ghostview Lhs2TeX.ps &
print : Lhs2TeX.dvi
dvips -D600 -f Lhs2TeX.dvi | lpr -Pa -Zl
install : lhs2TeX lhs2TeX.sty lhs2TeX.fmt
mv lhs2TeX $(binpath)
backup:
cd ..; \
rm -f Literate.tar Literate.tar.gz; \
tar -cf Literate.tar Literate; \
gzip Literate.tar; \
chmod a+r Literate.tar.gz
clean :
clean
rm -f lhs2TeX $(sections) $(snips) $(objects) *.hi *.dvi *.ps
rm -rf lhs2TeX.sty lhs2TeX.fmt
rm -rf Lhs2TeX.tex lhs2TeX.sty.tex lhs2TeX.fmt.tex Makefile.tex
all:
$(MAKE) install
$(MAKE) Lhs2TeX.dvi
\end{code}