diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-12-05 13:55:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-12-05 13:55:53 +0200 |
commit | 5a76a49019ecf77c9e56a1b14183a25912fa3637 (patch) | |
tree | 5f297d522d79e4db32ec107fb14995fd885fe69f /git/makefile | |
parent | ebf5e1d518027b88d28f6321638b39617aa44973 (diff) |
Add root makefile for building/running tests/examples for all databases
Diffstat (limited to 'git/makefile')
-rw-r--r-- | git/makefile | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/git/makefile b/git/makefile new file mode 100644 index 0000000..1d07993 --- /dev/null +++ b/git/makefile @@ -0,0 +1,56 @@ +# Root makefile that can be used to build/run tests and examples for some +# or all databases: +# make - build tests and examples for all the databases +# make test - build and run tests and examples for all the databases +# make <db> - build tests and examples for <db> +# make <db>-test - build and run tests and examples for <db> +# +db := oracle pgsql sqlite mysql + +.PHONY: all test $(db) $(addsuffix -test,$(db)) + +all: $(db) +test: $(addsuffix -test,$(db)) + +define set_dirs +edir := $$(wildcard examples-$1-default) +tdir := $$(wildcard tests-$1-default) + +ifeq ($$(edir),) +edir := examples-$1 +endif + +ifeq ($$(tdir),) +tdir := tests-$1 +endif +endef + +define build_rule +$1: edir := $$(edir) +$1: tdir := $$(tdir) + +$1: + @$$(MAKE) -C $$(edir) + @$$(MAKE) -C $$(tdir) +endef + +define test_rule +$1-test: edir := $$(edir) +$1-test: tdir := $$(tdir) + +$1-test: + @$$(MAKE) -C $$(edir) test + @$$(MAKE) -C $$(tdir) test +endef + +# Note: empty line at the end is important. +# +# +define rules +$(call set_dirs,$1) +$(call build_rule,$1) +$(call test_rule,$1) + +endef + +$(eval $(foreach d,$(db),$(call rules,$d))) |