2015-12-27 20:15:16 +00:00
|
|
|
FORMAT ?= svg
|
2016-02-18 12:44:03 +00:00
|
|
|
SOURCEDIR ?= $(CURDIR)
|
|
|
|
SOURCES = $(shell find $(SOURCEDIR) -type f -name '*.wsd')
|
2016-02-04 16:32:19 +00:00
|
|
|
TARGETS = $(foreach fmt, $(FORMAT), $(patsubst %.wsd,%.$(fmt),$(SOURCES)))
|
2015-12-27 20:15:16 +00:00
|
|
|
STYLE ?= style.isvg
|
|
|
|
|
2016-02-04 16:32:19 +00:00
|
|
|
.PHONY: all clean install-toolset force
|
2015-12-27 20:15:16 +00:00
|
|
|
|
2016-01-26 11:41:59 +00:00
|
|
|
validate = test -s $@ || { rm $@; exit 1; }
|
|
|
|
|
2015-12-27 20:15:16 +00:00
|
|
|
all: $(TARGETS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(TARGETS)
|
|
|
|
|
|
|
|
%.svg: %.wsd
|
|
|
|
cat $< \
|
|
|
|
| plantuml -tsvg -pipe \
|
|
|
|
| xmllint --format - \
|
|
|
|
| sed -e "/<g>/r $(STYLE)" \
|
|
|
|
> $@
|
2016-01-26 11:41:59 +00:00
|
|
|
$(validate)
|
2015-12-27 20:15:16 +00:00
|
|
|
|
|
|
|
%.png: %.wsd
|
|
|
|
$(MAKE) $*.svg
|
2016-02-03 16:57:25 +00:00
|
|
|
svgexport $*.svg $@ 2x && pngcrush -ow $@
|
2015-12-27 20:15:16 +00:00
|
|
|
rm -vf $*.svg
|
2016-01-26 11:41:59 +00:00
|
|
|
$(validate)
|
2015-12-27 20:15:16 +00:00
|
|
|
|
|
|
|
|
2016-02-03 16:57:25 +00:00
|
|
|
install-toolset: plantuml.tool xmllint.tool svgexport.tool pngcrush.tool
|
2015-12-27 20:15:16 +00:00
|
|
|
%.tool: force
|
2016-02-04 14:22:28 +00:00
|
|
|
$(MAKE) $*.tool.$$(uname -s)
|
2015-12-27 20:15:16 +00:00
|
|
|
plantuml.tool.Darwin:
|
|
|
|
brew install plantuml
|
2016-02-03 16:57:25 +00:00
|
|
|
svgexport.tool.Darwin:
|
|
|
|
brew install npm
|
|
|
|
npm install -g svgexport
|
|
|
|
pngcrush.tool.Darwin:
|
|
|
|
brew install pngcrush
|
2015-12-27 20:15:16 +00:00
|
|
|
xmllint.tool.Darwin:
|
|
|
|
true
|
|
|
|
|
|
|
|
force:
|
|
|
|
@true
|