#! /usr/bin/env make -f

all: json json-min html-fr html-en index-fr index-en

json:      out/calcdb.json
json-min:  out/calcdb-min.json
html-fr:   out/calcdb-fr.html
html-en:   out/calcdb-en.html
index-fr:  out/index-fr.html
index-en:  out/index-en.html

DEPS = $(wildcard calculators/* lang/*) model.yaml tools/calcdb.py | out/

out/calcdb.json: tools/convert-json.py $(DEPS)
	tools/convert-json.py > $@

out/calcdb-min.json: tools/convert-json.py $(DEPS)
	tools/convert-json.py --min > $@

out/calcdb-fr.html: tools/render-html.py $(DEPS)
	tools/render-html.py fr --standalone > $@

out/calcdb-en.html: tools/render-html.py $(DEPS)
	tools/render-html.py en --standalone > $@

out/index-fr.html: tools/render-html.py $(DEPS)
	tools/render-html.py fr > $@

out/index-en.html: tools/render-html.py $(DEPS)
	tools/render-html.py en > $@

%/:
	@ mkdir -p $@

.PHONY: json json-min html-fr html-en index-fr index-en
