JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
example code for scaling spritesheets
[wfpl-cms.git] / Makefile
1 svgs= images/sprites.svg
2 minified_svgs= $(svgs:.svg=.min.svg)
3 generated_images= $(svgs:.svg=.png)
4 images=
5 images += $(generated_images) $(minified_svgs)
6
7 objects= $(generated_images) $(minified_svgs) .sha1sums.styl css.css tags
8
9 all: $(objects)
10
11 clean:
12         rm -f $(objects)
13
14 css.css: style.styl .sha1sums.styl inc/wfpl/stylus_helpers.styl
15         stylus -p $< > $@ || rm -f "$@"
16
17 .sha1sums.styl: $(images)
18         ( \
19                 echo -n 'sha1 = {'; \
20                 div=' '; \
21                 for x in $^; do \
22                         echo -n "$$div '$$x': \"$$x?m=$$(sha1sum < $$x | head -c 10)\""; \
23                         div=,; \
24                 done; \
25                 echo " }"; \
26         ) > $@ || ( \
27                 rm -f $@; \
28                 exit 1; \
29         )
30 %.png: %.svg
31         ( \
32                 inkscape -f $< -e $@ --export-area-page --without-gui --export-dpi=360 \
33                 && mogrify -alpha off -geometry '25%' $@ \
34                 && pngfix $@ \
35         ) || ( \
36                 rm -f $@ \
37                 ; exit 1 \
38         )
39
40 %.min.svg: %.svg
41         svgo $< $@
42
43 tags: *.php inc/*.php inc/wfpl/*.php
44         ctags *.php inc/*.php inc/wfpl/*.php