diff --git a/Makefile b/Makefile index 76f260fe..f711c44d 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,28 @@ .PHONY: lint check_dupes install + +sources :=$(wildcard ./exercises/**.json) + lint: - check-jsonschema --schemafile ./schema.json ./exercises/**.json + check-jsonschema --schemafile ./schema.json $(sources) check_dupes: # check for duplicate id's, if there's ID's listed here # we've got duplicate id's that need to be resolved - jq -s ".[]" exercises/**.json | jq '.id' | sort | uniq -d + jq -s ".[]" $(sources) | jq '.id' | sort | uniq -d install: pip install check-jsonschema -dist/exercises.json: ./exercises/**.json +dist/exercises.json: $(sources) # requires jq # brew install jq (for macos) - jq -s '.' ./exercises/**.json > ./dist/exercises.json -dist/exercises.nd.json: ./exercises/**.json + jq -s '.' $^ > $@ +dist/exercises.nd.json: $(sources) # output to new line delimited JSON # for use to import into PostgreSQL via the COPY command # # https://konbert.com/blog/import-json-into-postgres-using-copy # https://www.postgresql.org/docs/current/sql-copy.html - jq -s '.[]' ./exercises/**.json > ./dist/exercises.nd.json + jq -s '.[]' $^ > $@ dist/exercises.csv: dist/exercises.json # output to csv format # requires in2csv which is part of # https://csvkit.readthedocs.io/ - in2csv ./dist/exercises.json > ./dist/exercises.csv + in2csv ./dist/exercises.json > $@