diff --git a/Makefile b/Makefile index b9af7e4..6f1a82d 100644 --- a/Makefile +++ b/Makefile @@ -21,17 +21,12 @@ PATH_DOC_IMG=${PATH_DOC}/img PATH_MANUAL_TEXI=${PATH_DOC}/manual.texi src_js := index.js $(wildcard $(PATH_LIB)/*.js) +src_tests := index.js $(wildcard $(PATH_TEST)/test-*) doc_src := $(wildcard $(PATH_DOC)/*.texi) doc_imgs := $(patsubst %.dia, %.png, $(wildcard $(PATH_DOC_IMG)/*.dia)) COMBINE=${PATH_TOOLS}/combine -TESTS := $(shell find "$(PATH_TEST)" \ - -name 'test-*' \ - -a ! -name 'test-combine*.js'\ -) -TEST_COMBINE := $(PATH_TEST)/test-combine*.js - .PHONY: combine doc test test-combine @@ -51,19 +46,15 @@ mkbuild-doc: $(PATH_DOC_OUTPUT) # browser) $(PATH_COMBINE_OUTPUT): $(src_js) | mkbuild ${COMBINE} > "$(PATH_COMBINE_OUTPUT)" -$(PATH_COMBINE_OUTPUT_FULL): $(src_js) | mkbuild +$(PATH_COMBINE_OUTPUT_FULL): $(src_js) $(src_tests) | mkbuild INC_TEST=1 "$(COMBINE)" > "${PATH_COMBINE_OUTPUT_FULL}" $(PATH_BUILD)/browser-test.html: $(PATH_COMBINE_OUTPUT_FULL) cp "$(PATH_BROWSER_TEST)" "$(PATH_BUILD)" combine: $(PATH_COMBINE_OUTPUT) $(PATH_BUILD)/browser-test.html -# run tests -test: default $(TESTS) test-combine -test-combine: default $(TEST_COMBINE) -test-%.js: default - node $@ -test-%: default - ./$@ + +test: + $(MAKE) -C $(PATH_TEST) # performance tests perf: default $(PERF_TESTS) diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..1a3e26b --- /dev/null +++ b/test/Makefile @@ -0,0 +1,17 @@ + +tests := $(shell find . \ + -name 'test-*' \ + -a ! -name 'test-combine*.js'\ +) +tests_combine := test-combine*.js + +.PHONY: FORCE test test-combine + + +default: $(tests) combine +combine: $(tests_combine) + +test-%.js: FORCE + node $@ +test-%: FORCE + ./$@