RPGs3_card_insanity/Makefile

43 lines
723 B
Makefile
Raw Normal View History

2019-09-08 23:07:26 +02:00
2019-09-09 18:48:15 +02:00
all: build/out.html
2019-09-08 23:07:26 +02:00
2019-09-09 18:48:15 +02:00
build/out.html: card.yaml build/card.xml build/style.xsl style.css
2019-09-08 23:07:26 +02:00
xsltproc \
2019-09-09 18:48:15 +02:00
-o build/out.html \
build/style.xsl \
build/card.xml
2019-09-08 23:07:26 +02:00
define TMP_PYTHON_PROG
from jinja2 import Environment, FileSystemLoader
with open("card.yaml") as f:
data = f.read()
out = Environment(
loader=FileSystemLoader('templates'))\
.get_template('card.xml.j2')\
.render(data=data)
#print(out)
2019-09-09 18:48:15 +02:00
with open("build/card.xml", "w") as f:
f.write(out)
2019-09-08 23:07:26 +02:00
endef
export TMP_PYTHON_PROG
2019-09-09 18:48:15 +02:00
build/card.xml:
2019-09-08 23:07:26 +02:00
python -c "$$TMP_PYTHON_PROG"
2019-09-09 18:48:15 +02:00
build/style.xsl: style.html.j2
cp style.html.j2 build/style.xsl
.PHONY: dev
dev:
git ls-files | entr make all
2019-09-08 23:07:26 +02:00
.PHONY: clean
clean:
rm build/* out.html