forked from patmorin/ods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (110 loc) · 5.21 KB
/
Makefile
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
sources = intro.tex arrays.tex linkedlists.tex skiplists.tex \
hashing.tex binarytrees.tex rbs.tex scapegoat.tex redblack.tex \
heaps.tex sorting.tex graphs.tex integers.tex btree.tex
javs = $(sources:.tex=-java.tex)
javh = $(sources:.tex=-java-html.tex)
cpps = $(sources:.tex=-cpp.tex)
cpph = $(sources:.tex=-cpp-html.tex)
java = $(wildcard ../java/ods/*.java)
cppsource = $(wildcard ../cpp/*.h)
python = $(wildcard ../python/ods/*.py)
pyts = $(sources:.tex=-python.tex)
pyth = $(sources:.tex=-python-html.tex)
pdfs = ods-java.pdf ods-cpp.pdf ods-python.pdf
styles=ods.sty ods-colors.sty
LFLAGS=-interaction=nonstopmode -halt-on-error
all: $(pdfs)
.PHONY: all figs images install clean
figs:
cd figs ; make
cd figs-python ; make
epsfigs:
cd figs ; make epss
cd figs-python ; make epss
images:
cd images ; make
ods-java.pdf : ods-java.tex $(javs) $(styles) images figs
latexmk -pdf ods-java
# pdflatex $(LFLAGS) ods-java
# bibtex ods-java
# pdflatex $(LFLAGS) ods-java
# pdflatex $(LFLAGS) ods-java
ods-java.tex : ods.tex Makefile
echo "%%%\n%%% Autogenerated file - do not edit \n%%%" | cat - ods.tex \
| sed 's/-lang/-java/' > ods-java.tex
sed -i 's/%HEADCOMMAND/\\newcommand{\\cpponly}[1]{}\\newcommand{\\javaonly}[1]{#1}\\newcommand{\\pcodeonly}[1]{}\\newcommand{\\notpcode}[1]{#1}\\newcommand{\\lang}{Java}/' ods-java.tex
ods-cpp.pdf : ods-cpp.tex $(cpps) $(styles) images figs
latexmk -pdf ods-cpp
# pdflatex $(LFLAGS) ods-cpp
# bibtex ods-cpp
# pdflatex $(LFLAGS) ods-cpp
# pdflatex $(LFLAGS) ods-cpp
ods-cpp.tex : ods.tex Makefile
echo "%%%\n%%% Autogenerated file - do not edit \n%%%" | cat - ods.tex \
| sed 's/-lang/-cpp/' > ods-cpp.tex
sed -i 's/%HEADCOMMAND/\\newcommand{\\javaonly}[1]{}\\newcommand{\\cpponly}[1]{#1}\\newcommand{\\pcodeonly}[1]{}\\newcommand{\\notpcode}[1]{#1}\\newcommand{\\lang}{C++}/' ods-cpp.tex
ods-python.pdf : ods-python.tex $(pyts) $(styles) images figs
latexmk -pdf ods-python
ods-python.tex : ods.tex Makefile
echo "%%%\n%%% Autogenerated file - do not edit \n%%%" | cat - ods.tex \
| sed 's/-lang/-python/' > ods-python.tex
sed -i 's/%HEADCOMMAND/\\newcommand{\\javaonly}[1]{}\\newcommand{\\cpponly}[1]{}\\newcommand{\\pcodeonly}[1]{#1}\\newcommand{\\notpcode}[1]{}\\newcommand{\\lang}{pseudocode}/' ods-python.tex
%-java.tex : %.tex $(java) snarf-java.pl Makefile
echo "%%%\n%%% Autogenerated file - do not edit \n%%%" | cat - $< \
| ./snarf-java.pl > $*-java.tex
%-cpp.tex : %.tex $(cppsource) snarf-cpp.pl Makefile
echo "%%%\n%%% Autogenerated file - do not edit \n%%%" | cat - $< \
| ./snarf-cpp.pl > $*-cpp.tex
%-python.tex : %.tex $(python) snarf-python.py Makefile
echo "%%%\n%%% Autogenerated file - do not edit \n%%%" | cat - $< \
| ./snarf-python.py > $*-python.tex
install-pdf : ods-java.pdf ods-cpp.pdf ods-python.pdf ods-java-screen.pdf ods-cpp-screen.pdf ods-python-screen.pdf
scp -r $^ [email protected]:public_html/ods/
install-html : java-html cpp-html python-html
scp -r ods-java/ ods-cpp/ ods-python/ [email protected]:public_html/ods/
install : install-pdf install-html
clean:
rm -f $(javs) $(cpps) $(pyts) $(javh) $(cpph) $(pyth) *.log *.bbl *.out ods.toc $(pdfs)
rm -rf ods-java/ ods-cpp/
cd figs; make clean
cd figs-python; make clean
cd images; make clean
# A dirty hack for getting a grayscale file
%-grayscale.pdf : %.pdf
gs -sOutputFile=$@ -sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray \
-dCompatibilityLevel=1.4 $< < /dev/null
# Lots of hackery for generating html using latex2html
html: java-html cpp-html python-html
java-html : $(javh) ods-java-html.tex epsfigs
mkdir -p ods-java
pdflatex ods-java-html
bibtex ods-java-html
latex2html -init_file latex2html-init -dir ods-java ods-java-html
ods-java-html.tex : ods.tex Makefile
sed 's/-lang/-java-html/' ods.tex > ods-java-html.tex
sed -i 's/%HEADCOMMAND/\\newcommand{\\cpponly}[1]{}\\newcommand{\\pcodeonly}[1]{}\\newcommand{\\javaonly}[1]{#1}\\newcommand{\\notpcode}[1]{#1}\\newcommand{\\lang}{Java}/' ods-java-html.tex
sed -i 's/\\include{cpp-preface}//' ods-java-html.tex
%-java-html.tex : %.tex $(java) snarf-java-html.pl Makefile
cat $< | ./snarf-java-html.pl > $*-java-html.tex
cpp-html : $(cpph) ods-cpp-html.tex epsfigs
mkdir -p ods-cpp
pdflatex ods-cpp-html
bibtex ods-cpp-html
latex2html -init_file latex2html-init -dir ods-cpp ods-cpp-html
ods-cpp-html.tex : ods.tex Makefile
sed 's/-lang/-cpp-html/' ods.tex > ods-cpp-html.tex
sed -i 's/%HEADCOMMAND/\\newcommand{\\javaonly}[1]{}\\newcommand{\\pcodeonly}[1]{}\\newcommand{\\cpponly}[1]{#1}\\newcommand{\\notpcode}[1]{#1}\\newcommand{\\lang}{C++}/' ods-cpp-html.tex
%-cpp-html.tex : %.tex $(cpp) snarf-cpp-html.pl Makefile
cat $< | ./snarf-cpp-html.pl > $*-cpp-html.tex
python-html : $(pyth) ods-python-html.tex epsfigs
mkdir -p ods-python
pdflatex ods-python-html
bibtex ods-python-html
latex2html -init_file latex2html-init -dir ods-python ods-python-html
ods-python-html.tex : ods-python.tex Makefile
sed 's/-python/-python-html/' ods-python.tex > ods-python-html.tex
%-python-html.tex : %.tex $(pyt) snarf-cpp-html.pl Makefile
cat $< | ./snarf-python.py -html > $*-python-html.tex
%-screen.pdf : %.pdf
gs -o $@ -sDEVICE=pdfwrite -c "[/CropBox [53 88 379 595] /PAGES pdfmark" -f $<