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