| |
@@ -1,26 +1,31 @@
|
| |
+ CACHE_DIR=.cache
|
| |
|
| |
# Convert, test and clean up by default.
|
| |
all: convert test clean
|
| |
|
| |
# Convert yaml specification to json schema.
|
| |
- SCHEMAS=$(shell ls schemas/*.yaml | sed 's/yaml/json/')
|
| |
+ SCHEMAS=$(patsubst schemas/%.yaml,$(CACHE_DIR)/%.json,$(wildcard schemas/*.yaml))
|
| |
|
| |
- schemas/%.json: schemas/%.yaml
|
| |
+ # Validate example messages against schemas.
|
| |
+ EXAMPLES=$(patsubst %.json,%.test,$(wildcard examples/*.json))
|
| |
+
|
| |
+ $(CACHE_DIR)/%.json: schemas/%.yaml
|
| |
@echo "Converting $*..."
|
| |
- scripts/convert.py schemas/$*.yaml schemas/$*.json
|
| |
+ @mkdir -p $(CACHE_DIR)
|
| |
+ scripts/convert.py $< $@
|
| |
|
| |
convert: $(SCHEMAS)
|
| |
|
| |
- # Validate example messages against schemas.
|
| |
- EXAMPLES=$(shell ls examples/* | sed 's/json/test/')
|
| |
-
|
| |
- examples/%.test: examples/%.json $(SCHEMAS)
|
| |
+ $(CACHE_DIR)/%.test: examples/%.json $(SCHEMAS)
|
| |
@echo "Checking $*... "
|
| |
- scripts/validate.py schemas/$*.json examples/$*.json
|
| |
- @touch examples/$*.test
|
| |
+ scripts/validate.py $(CACHE_DIR)/$*.json $<
|
| |
+ @touch $@
|
| |
+
|
| |
+ examples/%.test:
|
| |
+ $(MAKE) $(CACHE_DIR)/$*.test
|
| |
|
| |
test: $(EXAMPLES)
|
| |
|
| |
# Clean up stuff.
|
| |
clean:
|
| |
- rm -f schemas/*.json examples/*.test
|
| |
+ rm -rf $(CACHE_DIR)
|
| |
Keeps temporary files out of the way.
/cc @ralph