index.html.itex: Claim my stuff (the pyafm stack and sawsim)
[reveal.js.git] / Makefile
1 SRC = media/src
2 DEST = media/build
3
4 # full-sized image dimensions
5 WIDTH = 960
6 HEIGHT = 480
7
8 HALF_WIDTH = 480
9 HALF_HEIGHT = 240
10
11 THIRD_WIDTH = 320
12 THIRD_HEIGHT = 160
13
14 THUMBNAILS = \
15         $(DEST)/1TIT-atoms.mp4 \
16         $(DEST)/takamori-fig4b-fw-fh.png \
17         $(DEST)/skeletal-muscle-fw-fh.png \
18         $(DEST)/titin-fw-fh.png \
19         $(DEST)/1TIT-fw-fh.png \
20         $(DEST)/1TIT-tw-th.png \
21         $(DEST)/pirchi-fig1-fw-hh.png \
22         $(DEST)/afm-3d-fw-fh.png \
23         $(DEST)/contact-afm.ogv \
24         $(DEST)/afm-fw-fh.png \
25         $(DEST)/afm-hw-hh.png \
26         $(DEST)/piezo-fw-fh.png \
27         $(DEST)/unfolding-fw-fh.png \
28         $(DEST)/unfolding-hw-fh.png \
29         $(DEST)/unfolding-hw-hh.png \
30         $(DEST)/expt-sawtooth-fw-fh.png \
31         $(DEST)/expt-sawtooth-hw-hh.png \
32         $(DEST)/carrion-vazquez-fig2-fw-fh.png \
33         $(DEST)/lu-fig1-fw-fh.png \
34         $(DEST)/apparatus-fw-fh.png \
35         $(DEST)/labview-fw-fh.png \
36         $(DEST)/pyafm-fw-fh.png \
37         $(DEST)/pyafm-hw-hh.png \
38         $(DEST)/ants-fw-fh.png \
39         $(DEST)/cantilever.jpg \
40         $(DEST)/tip.jpg \
41         $(DEST)/calibcant-flow-hw-fh.png \
42         $(DEST)/vibration-fw-fh.png \
43         $(DEST)/vibration-hw-fh.png \
44         $(DEST)/bump-fw-fh.png \
45         $(DEST)/florin-fig2-hw-fh.png \
46         $(DEST)/pbs-hist-hw-hh.png \
47         $(DEST)/sawsim-states-hw-fh.png \
48         $(DEST)/sawsim-states-hw-hh.png \
49         $(DEST)/monte-carlo-fw-fh.png \
50         $(DEST)/landscape-hw-hh.png \
51         $(DEST)/landscape-hw-fh.png \
52         $(DEST)/landscape-bell-hw-hh.png \
53         $(DEST)/kramers-integrand-hw-hh.png \
54         $(DEST)/wlc-model-hw-fh.png \
55         $(DEST)/fjc-model-hw-fh.png \
56         $(DEST)/fit-valley-fw-fh.png \
57         $(DEST)/1TIT-hbond-fw-fh.png \
58         $(DEST)/fit-valley-PBS-hw-hh.png \
59         $(DEST)/fit-valley-PBS-0.5M-CaCl2-hw-hh.png \
60         $(DEST)/pbs-0.5M-CaCl2-hist-fw-fh.png
61
62 #       $(DEST)/landscape-cant-hw-hh.png
63
64 .PRECIOUS: $(DEST)/% $(DEST)/%.png $(DEST)/%.pdf
65
66 all: index.html $(THUMBNAILS)
67
68 clean:
69         rm -f index.html $(DEST)/* $(SRC)/pymol/*-0*.png
70
71 %: %.itex
72         itex2MML < "$(<)" > "$(@)"
73
74 ## Get the high-resolution source into PNG format
75
76 # plain copy
77 $(DEST)/%: $(SRC)/binary/%
78         cp "$(<)" "$(@)"
79
80 # TODO: re-render and crop?
81 $(DEST)/%: $(SRC)/matplotlib/%
82         cp "$(<)" "$(@)"
83
84 # TODO: re-render and crop?
85 $(DEST)/%: $(SRC)/tikz/%
86         cp "$(<)" "$(@)"
87
88 # TODO: extract from the VI?  (probably not ;)
89 $(DEST)/%: $(SRC)/labview/%
90         cp "$(<)" "$(@)"
91
92 # convert JPEGs
93 $(DEST)/%.png: $(SRC)/binary/%.jpg
94         convert "$(<)" "$(@)"
95
96 # convert PDFs
97 $(DEST)/%.png: $(SRC)/binary/%.pdf
98         convert -density 350 "$(<)" "$(@)"
99
100 # compile Asymptote graphics
101 $(DEST)/%.pdf: $(SRC)/asy/%.asy
102         asy -noprc -render=0 -f pdf -cd "$(<D)" -o "$(*).pdf" "$(*).asy"
103         mv "$(<D)/$(*).pdf" "$(@)"
104
105 # convert Asympote PDFs
106 $(DEST)/%.png: $(DEST)/%.pdf
107         convert -density 350 "$(<)" "$(@)"
108
109 # convert PyMol images
110 $(DEST)/%.png: $(SRC)/pymol/%.pml
111         cd "$(SRC)/pymol" && pymol -cq "$(*).pml"
112         mv "$(SRC)/pymol/$(*).png" "$(@)"
113
114 # convert PyMol images
115 $(DEST)/%.mp4: $(SRC)/pymol/%.pml
116         cd "$(SRC)/pymol" && pymol -cq "$(*).pml"
117         ffmpeg -y -r 20 -i "$(SRC)/pymol/$(*)-%4d.png" -s 640x480 -vcodec libx264 \
118                 -preset slower -vpre ipod640 -b:v 800k -bt 800k -aspect 640:480 \
119                 -threads 0 "$(@)"
120
121 ## Convert to the desired geometry
122
123 # full width, full height
124 $(DEST)/%-fw-fh.png: $(DEST)/%.png
125         convert -format png -strip -quality 95 "$(<)" -thumbnail $(WIDTH)x$(HEIGHT) "$(@)"
126
127 # half width, full height
128 $(DEST)/%-hw-fh.png: $(DEST)/%.png
129         convert -format png -strip -quality 95 "$(<)" -thumbnail $(HALF_WIDTH)x$(HEIGHT) "$(@)"
130
131 # full width, half height
132 $(DEST)/%-fw-hh.png: $(DEST)/%.png
133         convert -format png -strip -quality 95 "$(<)" -thumbnail $(WIDTH)x$(HALF_HEIGHT) "$(@)"
134
135 # half width, half height
136 $(DEST)/%-hw-hh.png: $(DEST)/%.png
137         convert -format png -strip -quality 95 "$(<)" -thumbnail $(HALF_WIDTH)x$(HALF_HEIGHT) "$(@)"
138
139 # third width, third height
140 $(DEST)/%-tw-th.png: $(DEST)/%.png
141         convert -format png -strip -quality 95 "$(<)" -thumbnail $(THIRD_WIDTH)x$(THIRD_HEIGHT) "$(@)"