plantuml-toolset/wsd.mk

46 lines
862 B
Makefile
Raw Permalink Normal View History

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')
TARGETS = $(foreach fmt, $(FORMAT), $(patsubst %.wsd,%.$(fmt),$(SOURCES)))
2015-12-27 20:15:16 +00:00
STYLE ?= style.isvg
.PHONY: all clean install-toolset force
2015-12-27 20:15:16 +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)" \
> $@
$(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
$(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