16 lines
617 B
Makefile
16 lines
617 B
Makefile
ASSETS=$(shell aq -it -oj -r '.[] | keys[]' < $(ASSET_TOML))
|
|
GENERATED_ASSETS=$(patsubst %,generated/%,$(ASSETS))
|
|
|
|
MAKO_SCRIPT=from mako.template import Template; \
|
|
import json; \
|
|
import sys; \
|
|
print(Template(filename=sys.argv[1]).render(**json.load(sys.stdin)))
|
|
AQ_FIND_SCRIPT=to_entries[] | select(.value|has("$*"))
|
|
|
|
$(GENERATED_ASSETS): generated/%: $(ASSET_TOML)
|
|
TEMPLATE="templates/$$(aq -it -oj -r '$(AQ_FIND_SCRIPT) | .key' < $^).mako"; \
|
|
aq -it -oj '$(AQ_FIND_SCRIPT) | .value["$*"]' < $^ \
|
|
| python -c '$(MAKO_SCRIPT)' "$$TEMPLATE" > $@.raw
|
|
rsync --remove-source-files --checksum $@.raw $@
|
|
|