sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / ext / wasm / SQLTester / GNUmakefile
| 1 | #!/this/is/make |
| 2 | # |
| 3 | # This makefile compiles SQLTester test files into something |
| 4 | # we can readily import into JavaScript. |
| 5 | all: |
| 6 | |
| 7 | SHELL := $(shell which bash 2>/dev/null) |
| 8 | MAKEFILE := $(lastword $(MAKEFILE_LIST)) |
| 9 | CLEAN_FILES := |
| 10 | DISTCLEAN_FILES := ./--dummy-- *~ |
| 11 | |
| 12 | test-list.mjs := test-list.mjs |
| 13 | test-list.mjs.gz := $(test-list.mjs).gz |
| 14 | CLEAN_FILES += $(test-list.mjs) |
| 15 | |
| 16 | tests.dir := $(firstword $(wildcard tests ../../jni/src/tests)) |
| 17 | $(info test script dir=$(tests.dir)) |
| 18 | |
| 19 | tests.all := $(wildcard $(tests.dir)/*.test) |
| 20 | |
| 21 | bin.touint8array := ./touint8array |
| 22 | $(bin.touint8array): $(bin.touint8array).c $(MAKEFILE) |
| 23 | $(CC) -o $@ $< |
| 24 | CLEAN_FILES += $(bin.touint8array) |
| 25 | |
| 26 | ifneq (,$(tests.all)) |
| 27 | $(test-list.mjs): $(bin.touint8array) $(tests.all) $(MAKEFILE) |
| 28 | @{\ |
| 29 | echo 'export default ['; \ |
| 30 | sep=''; \ |
| 31 | for f in $(sort $(tests.all)); do \ |
| 32 | echo -en $$sep'{"name": "'$${f##*/}'", "content":'; \ |
| 33 | $(bin.touint8array) < $$f; \ |
| 34 | echo -n '}'; \ |
| 35 | sep=',\n'; \ |
| 36 | done; \ |
| 37 | echo '];'; \ |
| 38 | } > $@ |
| 39 | @echo "Created $@" |
| 40 | $(test-list.mjs.gz): $(test-list.mjs) |
| 41 | gzip -c $< > $@ |
| 42 | CLEAN_FILES += $(test-list.mjs.gz) |
| 43 | all: $(test-list.mjs.gz) |
| 44 | else |
| 45 | @echo "Cannot build $(test-list.mjs) for lack of input test files."; \ |
| 46 | echo "Symlink ./tests to a directory containing SQLTester-format "; \ |
| 47 | echo "test scripts named *.test, then try again"; \ |
| 48 | exit 1 |
| 49 | endif |
| 50 | |
| 51 | .PHONY: clean distclean |
| 52 | clean: |
| 53 | -rm -f $(CLEAN_FILES) |
| 54 | distclean: clean |
| 55 | -rm -f $(DISTCLEAN_FILES) |