mirror of
https://github.com/valitydev/plantuml-toolset.git
synced 2024-11-06 01:45:18 +00:00
45 lines
817 B
Makefile
45 lines
817 B
Makefile
FORMAT ?= svg
|
|
SOURCES = $(wildcard *.wsd **/*.wsd)
|
|
TARGETS = $(foreach fmt, $(FORMAT), $(patsubst %.wsd,%.$(fmt),$(SOURCES)))
|
|
STYLE ?= style.isvg
|
|
|
|
.PHONY: all clean install-toolset force
|
|
|
|
validate = test -s $@ || { rm $@; exit 1; }
|
|
|
|
all: $(TARGETS)
|
|
|
|
clean:
|
|
rm -f $(TARGETS)
|
|
|
|
%.svg: %.wsd
|
|
cat $< \
|
|
| plantuml -tsvg -pipe \
|
|
| xmllint --format - \
|
|
| sed -e "/<g>/r $(STYLE)" \
|
|
> $@
|
|
$(validate)
|
|
|
|
%.png: %.wsd
|
|
$(MAKE) $*.svg
|
|
svgexport $*.svg $@ 2x && pngcrush -ow $@
|
|
rm -vf $*.svg
|
|
$(validate)
|
|
|
|
|
|
install-toolset: plantuml.tool xmllint.tool svgexport.tool pngcrush.tool
|
|
%.tool: force
|
|
$(MAKE) $*.tool.$$(uname -s)
|
|
plantuml.tool.Darwin:
|
|
brew install plantuml
|
|
svgexport.tool.Darwin:
|
|
brew install npm
|
|
npm install -g svgexport
|
|
pngcrush.tool.Darwin:
|
|
brew install pngcrush
|
|
xmllint.tool.Darwin:
|
|
true
|
|
|
|
force:
|
|
@true
|