11JSONSCHEMA ?= jsonschema
22SHELLCHECK ?= shellcheck
3+ JQ ?= jq
34PYTHON ?= python3
45CURL ?= curl
56TAR ?= tar
@@ -15,13 +16,32 @@ TESTS = $(shell find test/ -type f -name '*.json')
1516
1617VERSION = $(shell tr -d '\n\r' < VERSION)
1718
19+ GENERATED = \
20+ schemas/iso/currency/2015/alpha-code.json \
21+ schemas/iso/currency/2015/alpha-currency.json \
22+ schemas/iso/currency/2015/alpha-fund.json \
23+ schemas/iso/currency/2015/alpha-precious-metal.json \
24+ schemas/iso/currency/2015/alpha-test.json \
25+ schemas/iso/currency/2015/alpha-unknown.json \
26+ schemas/iso/currency/2015/numeric-code-additional.json \
27+ schemas/iso/currency/2015/numeric-code.json \
28+ schemas/iso/currency/2015/numeric-currency.json \
29+ schemas/iso/currency/2015/numeric-fund.json \
30+ schemas/iso/currency/2015/numeric-precious-metal.json \
31+ schemas/iso/currency/2015/numeric-test.json \
32+ schemas/iso/currency/2015/numeric-unknown.json \
33+ schemas/iso/currency/2015/historical/alpha-code.json \
34+ schemas/iso/currency/2015/historical/alpha-currency.json \
35+ schemas/iso/currency/2015/historical/numeric-code.json \
36+ schemas/iso/currency/2015/historical/numeric-currency.json
37+
1838# TODO: Make `jsonschema fmt` automatically detect test files
1939all : common test
2040 $(JSONSCHEMA ) fmt schemas meta --verbose
2141 $(JSONSCHEMA ) fmt test --verbose --default-dialect " https://json-schema.org/draft/2020-12/schema"
2242
2343.PHONY : common
24- common :
44+ common : $( GENERATED )
2545 $(JSONSCHEMA ) metaschema schemas meta --verbose
2646 $(JSONSCHEMA ) lint schemas meta --verbose
2747 $(JSONSCHEMA ) validate meta/schemas-root.json --verbose $(SCHEMAS )
@@ -42,10 +62,27 @@ test:
4262
4363build/iso/currency/list-% .json : scripts/xml2json.py vendor/data/iso/currency/list-% .xml
4464 $(PYTHON ) $< $(word 2,$^ ) $@
45- generate-iso-currency : generate/iso/currency/main.py \
46- build/iso/currency/list-one.json \
47- build/iso/currency/list-three.json
48- $(PYTHON ) $<
65+ schemas/iso/currency/2015/historical/alpha-code.json : build/iso/currency/list-three.json templates/iso/currency/2015/historical/alpha-code.jq
66+ $(MKDIRP ) $(dir $@ )
67+ $(JQ ) --from-file $(word 2,$^ ) $< > $@
68+ $(JSONSCHEMA ) fmt $@
69+ schemas/iso/currency/2015/historical/alpha-currency.json : build/iso/currency/list-three.json templates/iso/currency/2015/historical/alpha-currency.jq
70+ $(MKDIRP ) $(dir $@ )
71+ $(JQ ) --from-file $(word 2,$^ ) $< > $@
72+ $(JSONSCHEMA ) fmt $@
73+ schemas/iso/currency/2015/historical/numeric-code.json : build/iso/currency/list-three.json templates/iso/currency/2015/historical/numeric-code.jq
74+ $(MKDIRP ) $(dir $@ )
75+ $(JQ ) --from-file $(word 2,$^ ) $< > $@
76+ $(JSONSCHEMA ) fmt $@
77+ schemas/iso/currency/2015/historical/numeric-currency.json : build/iso/currency/list-three.json templates/iso/currency/2015/historical/numeric-currency.jq
78+ $(MKDIRP ) $(dir $@ )
79+ $(JQ ) --from-file $(word 2,$^ ) $< > $@
80+ $(JSONSCHEMA ) fmt $@
81+ schemas/iso/currency/2015/% .json : build/iso/currency/list-one.json templates/iso/currency/2015/% .jq
82+ $(MKDIRP ) $(dir $@ )
83+ $(JQ ) --from-file $(word 2,$^ ) $< > $@
84+ $(JSONSCHEMA ) fmt $@
85+
4986generate-iso-language : generate/iso/language/main.py
5087 $(PYTHON ) $<
5188generate-iso-country : generate/iso/country/main.py
0 commit comments