aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-06-21 10:39:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-06-21 10:39:59 +0200
commit6cd8b9f561b912f264ba4f723845935c40a3cb95 (patch)
tree5983e0af3d2ee621242ca6707a58c89b9914d8f0
parent236cd9bb1dd022e64d690c9b0080d1a15c5f61c7 (diff)
Add support for running tests in dynamic multi-database mode
Only possible in the development build system at this stage.
-rw-r--r--boost/common/makefile10
-rw-r--r--boost/common/multi-index/makefile29
-rw-r--r--boost/common/optional/makefile29
-rw-r--r--boost/common/smart-ptr/makefile29
-rw-r--r--boost/common/template/makefile29
-rw-r--r--boost/common/unordered/makefile29
-rw-r--r--boost/common/uuid/makefile29
-rw-r--r--boost/makefile15
-rw-r--r--boost/mssql/date-time/makefile21
-rw-r--r--boost/mssql/makefile5
-rw-r--r--boost/mssql/template/makefile21
-rw-r--r--boost/mysql/date-time/makefile21
-rw-r--r--boost/mysql/makefile5
-rw-r--r--boost/mysql/template/makefile21
-rw-r--r--boost/oracle/date-time/makefile21
-rw-r--r--boost/oracle/makefile5
-rw-r--r--boost/oracle/template/makefile21
-rw-r--r--boost/pgsql/date-time/makefile21
-rw-r--r--boost/pgsql/makefile5
-rw-r--r--boost/pgsql/template/makefile21
-rw-r--r--boost/sqlite/date-time/makefile21
-rw-r--r--boost/sqlite/makefile5
-rw-r--r--boost/sqlite/template/makefile21
-rw-r--r--build/bootstrap.make107
-rwxr-xr-xbuild/configure15
-rw-r--r--build/import/odb/hxx-cxx.make97
-rw-r--r--common/access/makefile29
-rw-r--r--common/access/test.hxx2
-rw-r--r--common/auto/makefile29
-rw-r--r--common/blob/makefile29
-rw-r--r--common/callback/driver.cxx1
-rw-r--r--common/callback/makefile29
-rw-r--r--common/changelog/makefile12
-rw-r--r--common/circular/multiple/driver.cxx19
-rw-r--r--common/circular/multiple/makefile28
-rw-r--r--common/circular/single/makefile29
-rw-r--r--common/composite-id/makefile29
-rw-r--r--common/composite/makefile29
-rw-r--r--common/const-member/makefile29
-rw-r--r--common/const-object/makefile29
-rw-r--r--common/container/basics/makefile29
-rw-r--r--common/container/change-tracking/makefile29
-rw-r--r--common/ctor/makefile29
-rw-r--r--common/default/driver.cxx11
-rw-r--r--common/default/makefile29
-rw-r--r--common/definition/makefile29
-rw-r--r--common/enum/makefile29
-rw-r--r--common/erase-query/driver.cxx30
-rw-r--r--common/erase-query/makefile29
-rw-r--r--common/include/makefile20
-rw-r--r--common/index/makefile29
-rw-r--r--common/inheritance/polymorphism/makefile30
-rw-r--r--common/inheritance/reuse/makefile29
-rw-r--r--common/inheritance/transient/makefile29
-rw-r--r--common/inverse/makefile29
-rw-r--r--common/lazy-ptr/makefile29
-rw-r--r--common/lifecycle/makefile29
-rw-r--r--common/makefile14
-rw-r--r--common/no-id/makefile29
-rw-r--r--common/optimistic/makefile29
-rw-r--r--common/pragma/makefile28
-rw-r--r--common/prepared/makefile29
-rw-r--r--common/query/array/driver.cxx34
-rw-r--r--common/query/array/makefile29
-rw-r--r--common/query/array/test.hxx3
-rw-r--r--common/query/basics/driver.cxx88
-rw-r--r--common/query/basics/makefile29
-rw-r--r--common/readonly/driver.cxx3
-rw-r--r--common/readonly/makefile29
-rw-r--r--common/relationship-query/makefile29
-rw-r--r--common/relationship/makefile29
-rw-r--r--common/schema/embedded/basics/driver.cxx11
-rw-r--r--common/schema/embedded/basics/makefile28
-rw-r--r--common/schema/embedded/order/driver.cxx20
-rw-r--r--common/schema/embedded/order/makefile28
-rw-r--r--common/schema/namespace/makefile29
-rw-r--r--common/schema/namespace/test.hxx2
-rw-r--r--common/session/cache/makefile29
-rw-r--r--common/session/custom/makefile29
-rw-r--r--common/template/makefile29
-rw-r--r--common/threads/driver.cxx18
-rw-r--r--common/threads/makefile29
-rw-r--r--common/transaction/basics/makefile15
-rw-r--r--common/transaction/callback/makefile15
-rw-r--r--common/types/makefile28
-rw-r--r--common/view/driver.cxx84
-rw-r--r--common/view/makefile29
-rw-r--r--common/virtual/makefile29
-rw-r--r--common/wrapper/makefile29
-rw-r--r--evolution/add-column/makefile34
-rw-r--r--evolution/add-foreign-key/makefile34
-rw-r--r--evolution/add-index/makefile34
-rw-r--r--evolution/add-table/makefile34
-rw-r--r--evolution/alter-column/makefile34
-rw-r--r--evolution/combined/makefile34
-rw-r--r--evolution/data/makefile30
-rw-r--r--evolution/drop-column/makefile34
-rw-r--r--evolution/drop-foreign-key/makefile34
-rw-r--r--evolution/drop-index/makefile34
-rw-r--r--evolution/drop-table/makefile34
-rw-r--r--evolution/embedded/makefile30
-rw-r--r--evolution/makefile5
-rw-r--r--evolution/template/makefile34
-rw-r--r--evolution/version/makefile34
-rw-r--r--libcommon/common/common.cxx314
-rw-r--r--libcommon/common/common.hxx13
-rw-r--r--libcommon/common/concrete.hxx9
-rw-r--r--libcommon/common/makefile44
-rw-r--r--libcommon/makefile4
-rw-r--r--makefile18
-rw-r--r--mssql/custom/makefile21
-rw-r--r--mssql/database/makefile11
-rw-r--r--mssql/makefile5
-rw-r--r--mssql/native/makefile11
-rw-r--r--mssql/query/makefile21
-rw-r--r--mssql/template/makefile21
-rw-r--r--mssql/types/makefile21
-rw-r--r--mysql/custom/makefile21
-rw-r--r--mysql/database/makefile11
-rw-r--r--mysql/index/makefile21
-rw-r--r--mysql/makefile5
-rw-r--r--mysql/native/makefile11
-rw-r--r--mysql/template/makefile21
-rw-r--r--mysql/truncation/makefile21
-rw-r--r--mysql/types/makefile21
-rw-r--r--oracle/custom/makefile21
-rw-r--r--oracle/database/makefile11
-rw-r--r--oracle/makefile5
-rw-r--r--oracle/native/makefile11
-rw-r--r--oracle/template/makefile21
-rw-r--r--oracle/types/makefile21
-rw-r--r--pgsql/custom/makefile21
-rw-r--r--pgsql/database/makefile11
-rw-r--r--pgsql/index/makefile17
-rw-r--r--pgsql/makefile5
-rw-r--r--pgsql/native/makefile11
-rw-r--r--pgsql/template/makefile17
-rw-r--r--pgsql/truncation/makefile21
-rw-r--r--pgsql/types/makefile21
-rw-r--r--qt/common/basic/makefile29
-rw-r--r--qt/common/containers/basics/makefile29
-rw-r--r--qt/common/containers/change-tracking/makefile29
-rw-r--r--qt/common/makefile10
-rw-r--r--qt/common/smart-ptr/makefile29
-rw-r--r--qt/common/template/makefile29
-rw-r--r--qt/makefile15
-rw-r--r--qt/mssql/basic/makefile21
-rw-r--r--qt/mssql/date-time/makefile21
-rw-r--r--qt/mssql/makefile5
-rw-r--r--qt/mssql/template/makefile21
-rw-r--r--qt/mysql/basic/makefile21
-rw-r--r--qt/mysql/date-time/makefile21
-rw-r--r--qt/mysql/makefile5
-rw-r--r--qt/mysql/template/makefile21
-rw-r--r--qt/oracle/basic/makefile21
-rw-r--r--qt/oracle/date-time/makefile21
-rw-r--r--qt/oracle/makefile5
-rw-r--r--qt/oracle/template/makefile21
-rw-r--r--qt/pgsql/basic/makefile21
-rw-r--r--qt/pgsql/date-time/makefile21
-rw-r--r--qt/pgsql/makefile5
-rw-r--r--qt/pgsql/template/makefile21
-rw-r--r--qt/sqlite/basic/makefile21
-rw-r--r--qt/sqlite/date-time/makefile21
-rw-r--r--qt/sqlite/makefile5
-rw-r--r--qt/sqlite/template/makefile21
-rw-r--r--sqlite/custom/makefile20
-rw-r--r--sqlite/database/makefile11
-rw-r--r--sqlite/makefile5
-rw-r--r--sqlite/native/makefile11
-rw-r--r--sqlite/template/makefile20
-rw-r--r--sqlite/truncation/makefile20
-rw-r--r--sqlite/types/makefile20
173 files changed, 1851 insertions, 2425 deletions
diff --git a/boost/common/makefile b/boost/common/makefile
index 266d9b9..4c81d25 100644
--- a/boost/common/makefile
+++ b/boost/common/makefile
@@ -15,11 +15,6 @@ uuid
all_tests := $(tests)
build_tests := $(tests)
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests)))
name := boost-common
@@ -35,6 +30,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests)))
$(call meta-vctest,$(name)-mysql-vc10.sln,test.bat)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(build_tests)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(tests))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_tests)))
$(call include,$(bld_root)/meta/vc9sln.make)
diff --git a/boost/common/multi-index/makefile b/boost/common/multi-index/makefile
index fabf4b7..2aa5651 100644
--- a/boost/common/multi-index/makefile
+++ b/boost/common/multi-index/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -76,12 +74,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -89,7 +86,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/common/optional/makefile b/boost/common/optional/makefile
index 5502501..e29b486 100644
--- a/boost/common/optional/makefile
+++ b/boost/common/optional/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -76,12 +74,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -89,7 +86,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/common/smart-ptr/makefile b/boost/common/smart-ptr/makefile
index 4574160..f41eb40 100644
--- a/boost/common/smart-ptr/makefile
+++ b/boost/common/smart-ptr/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -76,12 +74,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -89,7 +86,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/common/template/makefile b/boost/common/template/makefile
index ee924b1..881ac76 100644
--- a/boost/common/template/makefile
+++ b/boost/common/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -76,12 +74,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -89,7 +86,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/common/unordered/makefile b/boost/common/unordered/makefile
index 88cad51..0ed08d8 100644
--- a/boost/common/unordered/makefile
+++ b/boost/common/unordered/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -76,12 +74,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -89,7 +86,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/common/uuid/makefile b/boost/common/uuid/makefile
index dbb3016..3498175 100644
--- a/boost/common/uuid/makefile
+++ b/boost/common/uuid/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -76,12 +74,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -89,7 +86,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/makefile b/boost/makefile
index 264655a..ff5f003 100644
--- a/boost/makefile
+++ b/boost/makefile
@@ -6,12 +6,12 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
all_dirs := common mysql sqlite pgsql oracle mssql
dirs := common
-dirs += $(db_id)
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
+# Database-specific tests are not run in the multi-database configuration.
+#
+ifneq ($(db_id),common)
+dirs += $(db_id)
+endif
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs)))
@@ -21,6 +21,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_dirs)))
$(call meta-automake)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(dirs)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(dirs))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_dirs)))
$(call include,$(bld_root)/dist.make)
diff --git a/boost/mssql/date-time/makefile b/boost/mssql/date-time/makefile
index f7ce059..cc9dff1 100644
--- a/boost/mssql/date-time/makefile
+++ b/boost/mssql/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql \
@@ -78,12 +72,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -91,7 +80,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/mssql/makefile b/boost/mssql/makefile
index 81c0ebb..6751f63 100644
--- a/boost/mssql/makefile
+++ b/boost/mssql/makefile
@@ -8,11 +8,6 @@ tests := \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := boost-mssql
diff --git a/boost/mssql/template/makefile b/boost/mssql/template/makefile
index fa9149c..6c472e0 100644
--- a/boost/mssql/template/makefile
+++ b/boost/mssql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --profile boost \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/mysql/date-time/makefile b/boost/mysql/date-time/makefile
index 401e5cc..aaff422 100644
--- a/boost/mysql/date-time/makefile
+++ b/boost/mysql/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --profile boost/date-time \
@@ -77,12 +71,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -90,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/mysql/makefile b/boost/mysql/makefile
index 069d6e0..748c54a 100644
--- a/boost/mysql/makefile
+++ b/boost/mysql/makefile
@@ -8,11 +8,6 @@ tests := \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := boost-mysql
diff --git a/boost/mysql/template/makefile b/boost/mysql/template/makefile
index 33b2440..5ca6481 100644
--- a/boost/mysql/template/makefile
+++ b/boost/mysql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --profile boost \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/oracle/date-time/makefile b/boost/oracle/date-time/makefile
index 9c804c0..0b386ca 100644
--- a/boost/oracle/date-time/makefile
+++ b/boost/oracle/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle \
@@ -78,12 +72,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -91,7 +80,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/oracle/makefile b/boost/oracle/makefile
index 3294e24..e7e72ab 100644
--- a/boost/oracle/makefile
+++ b/boost/oracle/makefile
@@ -8,11 +8,6 @@ tests := \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := boost-oracle
diff --git a/boost/oracle/template/makefile b/boost/oracle/template/makefile
index ca488c0..18e3307 100644
--- a/boost/oracle/template/makefile
+++ b/boost/oracle/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --profile boost \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/pgsql/date-time/makefile b/boost/pgsql/date-time/makefile
index a899d40..5915e53 100644
--- a/boost/pgsql/date-time/makefile
+++ b/boost/pgsql/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --profile boost/date-time \
@@ -77,12 +71,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -90,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/pgsql/makefile b/boost/pgsql/makefile
index 94e993f..4834247 100644
--- a/boost/pgsql/makefile
+++ b/boost/pgsql/makefile
@@ -8,11 +8,6 @@ tests := \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := boost-pgsql
diff --git a/boost/pgsql/template/makefile b/boost/pgsql/template/makefile
index 1c63146..5423cbc 100644
--- a/boost/pgsql/template/makefile
+++ b/boost/pgsql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --profile boost \
@@ -77,12 +71,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -90,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/sqlite/date-time/makefile b/boost/sqlite/date-time/makefile
index 732cb09..8f4e620 100644
--- a/boost/sqlite/date-time/makefile
+++ b/boost/sqlite/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --profile boost/date-time \
@@ -77,12 +71,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -90,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/boost/sqlite/makefile b/boost/sqlite/makefile
index e76501d..c0a26f5 100644
--- a/boost/sqlite/makefile
+++ b/boost/sqlite/makefile
@@ -8,11 +8,6 @@ tests := \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := boost-sqlite
diff --git a/boost/sqlite/template/makefile b/boost/sqlite/template/makefile
index 77500d2..b6b1fb0 100644
--- a/boost/sqlite/template/makefile
+++ b/boost/sqlite/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -42,9 +39,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \
$(boost.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --profile boost \
@@ -77,12 +71,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -90,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/build/bootstrap.make b/build/bootstrap.make
index 178f2aa..7d5b84e 100644
--- a/build/bootstrap.make
+++ b/build/bootstrap.make
@@ -27,21 +27,64 @@ def_goal := $(.DEFAULT_GOAL)
#
$(call include,$(bld_root)/cxx/configuration.make)
+# Databases.
+#
+databases := mysql sqlite pgsql oracle mssql
+$(dist): databases := $(databases)
+
# Aliases
#
-.PHONY: $(out_base)/ \
- $(out_base)/.test \
- $(out_base)/.dist \
- $(out_base)/.clean
+default := $(out_base)/
+driver := $(out_base)/driver
+test := $(out_base)/.test
+dist := $(out_base)/.dist
+clean := $(out_base)/.clean
+
+.PHONY: $(default) \
+ $(test) \
+ $(dist) \
+ $(clean)
+
+ifeq ($(db_id),common)
+define db-test-target
+test_$1 := $$(out_base)/.test-$1
+.PHONY: $$(test_$1)
+$$(test): $$(test_$1)
-ifdef %interactive%
+endef
+$(foreach d,$(databases),$(eval $(call db-test-target,$d)))
+
+define db-test-dir
+$$(test_$1): $$(addprefix $$(out_base)/,$$(addsuffix /.test-$1,$2))
+
+endef
+endif
+ifdef %interactive%
.PHONY: test dist clean
+test: $(test)
+dist: $(dist)
+clean: $(clean)
-test: $(out_base)/.test
-dist: $(out_base)/.dist
-clean: $(out_base)/.clean
+ifeq ($(db_id),common)
+define db-test-alias
+.PHONY: test-$1
+test-$1: $$(test_$1)
+endef
+$(foreach d,$(databases),$(eval $(call db-test-alias,$d)))
+endif
+endif
+
+# Return the list of ODB-generated files given a list of header files.
+#
+ifdef db_id
+ifneq ($(db_id),common)
+odb-gen = $(foreach f,$(1:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
+else
+odb-gen = $(foreach f,$(1:.hxx=),$(addprefix $f, -odb.hxx -odb.ixx -odb.cxx \
+$(foreach d,$(databases),-odb-$d.hxx -odb-$d.ixx -odb-$d.cxx -$d.sql)))
+endif
endif
# By default the ODB header is called test.hxx.
@@ -50,13 +93,50 @@ $(out_base)/.dist: export odb_header_stem := test
# Database schema creation.
#
-ifeq ($(filter $(db_id),sqlite),)
-$(out_base)/.test: schema-body = \
-$(call message,sql $$1,$(dcf_root)/$(db_id)-driver $$1,$1)$(literal_newline)$(literal_tab)
+ifneq ($(db_id),sqlite)
+$(out_base)/.test $(addprefix $(out_base)/.test-,$(databases)): schema-body = \
+$(call message,sql $$1,$(dcf_root)/$1-driver $$1,$2)$(literal_newline)$(literal_tab)
+
+ifneq ($(db_id),common)
$(out_base)/.test: schema = \
-$(foreach s,$(if $1,$1,$(out_base)/test.sql),$(call schema-body,$s))@:
+$(foreach s,$(if $1,$1,$(out_base)/test.sql),$(call schema-body,$(db_id),$s))@:
+else
+define db-schema
+$$(out_base)/.test-$1: schema-$1 = \
+$$(foreach s,$$(if $$1,$$(filter %-$1.sql,$$1),$$(out_base)/test-$1.sql),$$(call schema-body,$1,$$s))@:
+
+endef
+$(foreach d,$(filter-out sqlite,$(databases)),$(eval $(call db-schema,$d)))
+endif
endif
+# Test rule templates.
+#
+
+# $1 database name in the multi-database mode and empty otherwise
+#
+define test-schemaless-rule
+$$(test$(if $1,_$1)): $$(driver) $$(src_base)/test.std
+ $$(call message,test$(if $1, [$1]) $$<,$$< $1 --options-file \
+$$(dcf_root)/$(if $1,$1,$(db_id)).options >$$(out_base)/test.out)
+ $$(call message,,diff -u $$(src_base)/test.std $$(out_base)/test.out)
+ $$(call message,,rm -f $$(out_base)/test.out)
+
+endef
+
+# $1 database name in the multi-database mode and empty otherwise
+# $2 optional list of schema files, by default test.sql
+#
+define test-rule
+$$(test$(if $1,_$1)): $$(driver) $$(src_base)/test.std
+ $$(call schema$(if $1,-$1),$2)
+ $$(call message,test$(if $1, [$1]) $$<,$$< $1 --options-file \
+$$(dcf_root)/$(if $1,$1,$(db_id)).options >$$(out_base)/test.out)
+ $$(call message,,diff -u $$(src_base)/test.std $$(out_base)/test.out)
+ $$(call message,,rm -f $$(out_base)/test.out)
+
+endef
+
# Dist setup.
#
ifneq ($(filter $(MAKECMDGOALS),dist),)
@@ -67,9 +147,6 @@ ifeq ($(dist_prefix),)
$(error dist_prefix is not set)
endif
-databases := mysql sqlite pgsql oracle mssql
-$(dist): databases := $(databases)
-
# $1 project template without the -vcN.vc[x]proj suffix.
# $2 project name without the -vcN.vc[x]proj suffix.
#
diff --git a/build/configure b/build/configure
index aecf319..1184b5b 100755
--- a/build/configure
+++ b/build/configure
@@ -18,6 +18,8 @@ $echo "configuring '$project_name'"
$echo
$echo
+databases="mysql sqlite pgsql oracle mssql"
+
$echo
$echo "Please select the database you would like to use:"
$echo
@@ -26,10 +28,19 @@ $echo "(2) SQLite"
$echo "(3) PostgreSQL"
$echo "(4) Oracle"
$echo "(5) Microsoft SQL Server"
+$echo "(6) Dynamic multi-database support (all above databases)"
$echo
-db_id=`read_option "mysql sqlite pgsql oracle mssql"`
+db_id=`read_option "$databases common"`
echo "db_id := $db_id" >$1
-source $scf_root/$db_id/configure
+if [ $db_id != "common" ]; then
+ source $scf_root/$db_id/configure
+else
+ # For multi-database support we configure every database.
+ #
+ for db in $databases; do
+ source $scf_root/$db/configure
+ done
+fi
diff --git a/build/import/odb/hxx-cxx.make b/build/import/odb/hxx-cxx.make
index a67d6b7..683827e 100644
--- a/build/import/odb/hxx-cxx.make
+++ b/build/import/odb/hxx-cxx.make
@@ -9,45 +9,95 @@
#
$(call include,$(bld_root)/cxx/configuration.make)
+odb_databases := mysql sqlite pgsql oracle mssql
+
odb_pattern := \
$(out_base)/%-odb.$(cxx_s_suffix) \
$(out_base)/%-odb.$(cxx_h_suffix) \
$(out_base)/%-odb.$(cxx_i_suffix) \
$(out_base)/%.sql
-$(odb_pattern): odb_options := \
---hxx-suffix .$(cxx_h_suffix) \
---ixx-suffix .$(cxx_i_suffix) \
+odb_patterns := $(odb_pattern)
+
+define odb-db-pattern
+odb_$1_pattern := \
+$$(out_base)/%-odb-$1.$$(cxx_s_suffix) \
+$$(out_base)/%-odb-$1.$$(cxx_h_suffix) \
+$$(out_base)/%-odb-$1.$$(cxx_i_suffix) \
+$$(out_base)/%-$1.sql
+
+odb_patterns += $$(odb_$1_pattern)
+
+endef # Trailing newline is important.
+
+$(foreach d,$(odb_databases),$(eval $(call odb-db-pattern,$d)))
+
+$(odb_patterns): odb_options := \
+--hxx-suffix .$(cxx_h_suffix) \
+--ixx-suffix .$(cxx_i_suffix) \
--cxx-suffix .$(cxx_s_suffix)
-$(odb_pattern): odb-expand-cpp-options-impl = \
+$(odb_patterns): odb-expand-cpp-options-impl = \
$(if $1,$(shell sed -e 's%include: \(.*\)%\1%' -e t -e d $1))
-$(odb_pattern): odb-expand-cpp-options = \
+$(odb_patterns): odb-expand-cpp-options = \
$(call odb-expand-cpp-options-impl,$(filter %.cpp-options,$1))
-.PRECIOUS: $(odb_pattern)
+# We only check for the long option name to avoid false positives.
+#
+$(odb_pattern): odb-default-database = \
+$(if $(filter --multi-database ,$(odb_options)),--database common )
+
+$(odb_pattern): odb-default-database-message = \
+$(if $(filter --multi-database ,$(odb_options)),[common] )
+
+.PRECIOUS: $(odb_patterns)
ifeq ($(out_base),$(src_base))
$(odb_pattern): $(src_base)/%.$(cxx_h_suffix)
- $(call message,odb $<,$(odb) $(cpp_options) \
-$(call odb-expand-cpp-options,$^) $(cxx_pp_extra_options) $(odb_options) \
---output-dir $(dir $@) $<)
+ $(call message,odb $(call odb-default-database-message)$<,$(odb) \
+$(cpp_options) $(call odb-expand-cpp-options,$^) $(cxx_pp_extra_options) \
+$(odb_options) $(call odb-default-database)--output-dir $(dir $@) $<)
+
+define odb-db-rule
+$$(odb_$1_pattern): $$(src_base)/%.$$(cxx_h_suffix)
+ $$(call message,odb [$1] $$<,$$(odb) $$(cpp_options) \
+$$(call odb-expand-cpp-options,$$^) $$(cxx_pp_extra_options) $$(odb_options) \
+--database $1 --output-dir $$(dir $$@) $$<)
+
+endef # Trailing newline is important.
else
$(odb_pattern): $(src_base)/%.$(cxx_h_suffix) | $$(dir $$@).
- $(call message,odb $<,$(odb) $(cpp_options) \
-$(call odb-expand-cpp-options,$^) $(cxx_pp_extra_options) $(odb_options) \
---output-dir $(dir $@) $<)
+ $(call message,odb $(call odb-default-database-message)$<,$(odb) \
+$(cpp_options) $(call odb-expand-cpp-options,$^) $(cxx_pp_extra_options) \
+$(odb_options) $(call odb-default-database)--output-dir $(dir $@) $<)
$(odb_pattern): $(out_base)/%.$(cxx_h_suffix) | $$(dir $$@).
- $(call message,odb $<,$(odb) $(cpp_options) \
-$(call odb-expand-cpp-options,$^) $(cxx_pp_extra_options) $(odb_options) \
---output-dir $(dir $@) $<)
+ $(call message,odb $(call odb-default-database-message)$<,$(odb) \
+$(cpp_options) $(call odb-expand-cpp-options,$^) $(cxx_pp_extra_options) \
+$(odb_options) $(call odb-default-database) --output-dir $(dir $@) $<)
+
+define odb-db-rule
+$$(odb_$1_pattern): $$(src_base)/%.$$(cxx_h_suffix) | $$$$(dir $$$$@).
+ $$(call message,odb [$1] $$<,$$(odb) $$(cpp_options) \
+$$(call odb-expand-cpp-options,$$^) $$(cxx_pp_extra_options) $$(odb_options) \
+--database $1 --output-dir $$(dir $$@) $$<)
+
+$$(odb_$1_pattern): $$(out_base)/%.$$(cxx_h_suffix) | $$$$(dir $$$$@).
+ $$(call message,odb [$1] $$<,$$(odb) $$(cpp_options) \
+$$(call odb-expand-cpp-options,$$^) $$(cxx_pp_extra_options) $$(odb_options) \
+--database $1 --output-dir $$(dir $$@) $$<)
+
+endef # Trailing newline is important.
endif
+$(foreach d,$(odb_databases),$(eval $(call odb-db-rule,$d)))
+
+# Clean.
+#
.PHONY: $(out_base)/%-odb.cxx.hxx.clean
$(out_base)/%-odb.cxx.hxx.clean: cxx_s_suffix := $(cxx_s_suffix)
@@ -59,3 +109,20 @@ $(out_base)/%-odb.cxx.hxx.clean:
$(call message,rm $$1,rm -f $$1,$(@:.cxx.hxx.clean=.$(cxx_h_suffix)))
$(call message,rm $$1,rm -f $$1,$(@:.cxx.hxx.clean=.$(cxx_i_suffix)))
$(call message,rm $$1,rm -f $$1,$(@:-odb.cxx.hxx.clean=.sql))
+
+define odb-db-clean-rule
+.PHONY: $$(out_base)/%-odb-$1.cxx.hxx.clean
+
+$$(out_base)/%-odb-$1.cxx.hxx.clean: cxx_s_suffix := $$(cxx_s_suffix)
+$$(out_base)/%-odb-$1.cxx.hxx.clean: cxx_h_suffix := $$(cxx_h_suffix)
+$$(out_base)/%-odb-$1.cxx.hxx.clean: cxx_i_suffix := $$(cxx_i_suffix)
+
+$$(out_base)/%-odb-$1.cxx.hxx.clean:
+ $$(call message,rm $$$$1,rm -f $$$$1,$$(@:.cxx.hxx.clean=.$$(cxx_s_suffix)))
+ $$(call message,rm $$$$1,rm -f $$$$1,$$(@:.cxx.hxx.clean=.$$(cxx_h_suffix)))
+ $$(call message,rm $$$$1,rm -f $$$$1,$$(@:.cxx.hxx.clean=.$$(cxx_i_suffix)))
+ $$(call message,rm $$$$1,rm -f $$$$1,$$(@:-odb-$1.cxx.hxx.clean=-$1.sql))
+
+endef # Trailing newline is important.
+
+$(foreach d,$(odb_databases),$(eval $(call odb-db-clean-rule,$d)))
diff --git a/common/access/makefile b/common/access/makefile
index 1cb1d2f..9d9da3b 100644
--- a/common/access/makefile
+++ b/common/access/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -40,7 +34,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -67,12 +65,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -80,7 +77,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/access/test.hxx b/common/access/test.hxx
index 4073766..6c4516e 100644
--- a/common/access/test.hxx
+++ b/common/access/test.hxx
@@ -26,6 +26,8 @@
# define BINARY16_TYPE "RAW(16)"
# elif defined(ODB_DATABASE_MSSQL)
# define BINARY16_TYPE "BINARY(16)"
+# elif defined(ODB_DATABASE_COMMON)
+# define BINARY16_TYPE ""
# else
# error unknown database
# endif
diff --git a/common/auto/makefile b/common/auto/makefile
index ed5e3f9..409d5b6 100644
--- a/common/auto/makefile
+++ b/common/auto/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix auto_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/blob/makefile b/common/blob/makefile
index 4deb80e..4cdfd01 100644
--- a/common/blob/makefile
+++ b/common/blob/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix blob_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/callback/driver.cxx b/common/callback/driver.cxx
index 0597645..d8e91db 100644
--- a/common/callback/driver.cxx
+++ b/common/callback/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <common/common.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include "test.hxx"
#include "test-odb.hxx"
diff --git a/common/callback/makefile b/common/callback/makefile
index f38fa60..35e2254 100644
--- a/common/callback/makefile
+++ b/common/callback/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/changelog/makefile b/common/changelog/makefile
index 8d5e96d..bd0f243 100644
--- a/common/changelog/makefile
+++ b/common/changelog/makefile
@@ -15,14 +15,11 @@ add-index.hxx \
drop-index.hxx \
add-foreign-key.hxx \
drop-foreign-key.hxx
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(call import,\
#
$(default):
-genf := $(foreach f,$(odb_hdr:.hxx=-odb),$(addprefix $f,.hxx .ixx .cxx))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb) FORCE # Force regeneration even if up to date.
$(gen): odb := $(odb)
$(gen): export odb_options += --database $(db_id) --generate-schema-only \
@@ -81,7 +75,7 @@ $(test): | $(out_base)/.
# Clean.
#
$(clean): changelogs := $(addprefix $(out_base)/,$(odb_hdr:.hxx=.xml))
-$(clean): $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+$(clean): $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(changelogs))
# Generated .gitignore.
diff --git a/common/circular/multiple/driver.cxx b/common/circular/multiple/driver.cxx
index cc730be..09a34e7 100644
--- a/common/circular/multiple/driver.cxx
+++ b/common/circular/multiple/driver.cxx
@@ -15,7 +15,6 @@
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test1.hxx"
@@ -43,21 +42,19 @@ main (int argc, char* argv[])
// For these databases this is the only way to drop circularly-
// dependant tables.
//
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=0");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=OFF");
-#endif
+ if (db->id () == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=0");
+ else if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
transaction t (c->begin ());
schema_catalog::create_schema (*db);
t.commit ();
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=1");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=ON");
-#endif
+ if (db->id () == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=1");
+ else if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
}
query<base> bq (query<base>::d->id != 0);
diff --git a/common/circular/multiple/makefile b/common/circular/multiple/makefile
index 92784d1..d603c82 100644
--- a/common/circular/multiple/makefile
+++ b/common/circular/multiple/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -43,7 +37,11 @@ $(gen): $(common.l.cpp-options)
#
$(gen): $(addprefix $(src_base)/,$(odb_hdr))
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -71,11 +69,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -83,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/circular/single/makefile b/common/circular/single/makefile
index 1708b6c..1e88748 100644
--- a/common/circular/single/makefile
+++ b/common/circular/single/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/composite-id/makefile b/common/composite-id/makefile
index 29227ae..59ffd1b 100644
--- a/common/composite-id/makefile
+++ b/common/composite-id/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/composite/makefile b/common/composite/makefile
index a1fed9b..c32f9c8 100644
--- a/common/composite/makefile
+++ b/common/composite/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/const-member/makefile b/common/const-member/makefile
index fc855c5..d366517 100644
--- a/common/const-member/makefile
+++ b/common/const-member/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix constm_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/const-object/makefile b/common/const-object/makefile
index d8015cf..46c968c 100644
--- a/common/const-object/makefile
+++ b/common/const-object/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/container/basics/makefile b/common/container/basics/makefile
index d6c4949..433d610 100644
--- a/common/container/basics/makefile
+++ b/common/container/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/container/change-tracking/makefile b/common/container/change-tracking/makefile
index de4c148..354059f 100644
--- a/common/container/change-tracking/makefile
+++ b/common/container/change-tracking/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/ctor/makefile b/common/ctor/makefile
index a94a113..ab1dc32 100644
--- a/common/ctor/makefile
+++ b/common/ctor/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/default/driver.cxx b/common/default/driver.cxx
index 515cb38..56f9a3d 100644
--- a/common/default/driver.cxx
+++ b/common/default/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <common/common.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include "test.hxx"
#include "test-odb.hxx"
@@ -34,11 +33,11 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- db->execute ("INSERT INTO default_object (obj_id) VALUES (1)");
-#else
- db->execute ("INSERT INTO \"default_object\" (\"obj_id\") VALUES (1)");
-#endif
+ if (db->id () != odb::id_oracle)
+ db->execute ("INSERT INTO default_object (obj_id) VALUES (1)");
+ else
+ db->execute ("INSERT INTO \"default_object\" (\"obj_id\") VALUES (1)");
+
t.commit ();
}
diff --git a/common/default/makefile b/common/default/makefile
index 44e6d04..652af83 100644
--- a/common/default/makefile
+++ b/common/default/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/definition/makefile b/common/definition/makefile
index 370a739..280a27c 100644
--- a/common/definition/makefile
+++ b/common/definition/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx time-mapping.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -43,7 +37,11 @@ $(gen): $(common.l.cpp-options)
#
$(gen): $(src_base)/time-mapping.hxx
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -71,12 +69,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -84,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/enum/makefile b/common/enum/makefile
index 466ad98..00e7da4 100644
--- a/common/enum/makefile
+++ b/common/enum/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/erase-query/driver.cxx b/common/erase-query/driver.cxx
index 6c69bfc..302e506 100644
--- a/common/erase-query/driver.cxx
+++ b/common/erase-query/driver.cxx
@@ -12,7 +12,6 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test.hxx"
@@ -62,13 +61,14 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- assert (db->erase_query<object> (
- "erase_query_object.id < 3") == 2);
-#else
- assert (db->erase_query<object> (
- "\"erase_query_object\".\"id\" < 3") == 2);
-#endif
+
+ if (db->id () != odb::id_oracle)
+ assert (db->erase_query<object> (
+ "erase_query_object.id < 3") == 2);
+ else
+ assert (db->erase_query<object> (
+ "\"erase_query_object\".\"id\" < 3") == 2);
+
db->erase_query<object> ();
t.commit ();
}
@@ -162,13 +162,13 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- assert (db->execute ("SELECT * FROM erase_query_object_v "
- "WHERE object_id = 1") == 0);
-#else
- assert (db->execute ("SELECT * FROM \"erase_query_object_v\" "
- "WHERE \"object_id\" = 1") == 0);
-#endif
+
+ if (db->id () != odb::id_oracle)
+ assert (db->execute ("SELECT * FROM erase_query_object_v "
+ "WHERE object_id = 1") == 0);
+ else
+ assert (db->execute ("SELECT * FROM \"erase_query_object_v\" "
+ "WHERE \"object_id\" = 1") == 0);
t.commit ();
}
}
diff --git a/common/erase-query/makefile b/common/erase-query/makefile
index 949064e..f66d840 100644
--- a/common/erase-query/makefile
+++ b/common/erase-query/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/include/makefile b/common/include/makefile
index eb25d9f..9428c59 100644
--- a/common/include/makefile
+++ b/common/include/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := obj1.hxx obj2.hxx obj3.hxx test1.hxx test2.hxx test3.hxx test4.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -30,9 +27,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) \
-I$(out_base)/../.. -I$(src_base)/../..
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=-odb),$(addprefix $f,.hxx .ixx .cxx))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen): odb_options += --database $(db_id) --table-prefix include_
@@ -51,11 +45,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -63,7 +53,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/index/makefile b/common/index/makefile
index 610aec3..690e2ab 100644
--- a/common/index/makefile
+++ b/common/index/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix index_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inheritance/polymorphism/makefile b/common/inheritance/polymorphism/makefile
index d7a8e2f..2609151 100644
--- a/common/inheritance/polymorphism/makefile
+++ b/common/inheritance/polymorphism/makefile
@@ -8,17 +8,14 @@ cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx test4.hxx test5.hxx test6.hxx \
test7.hxx test8.hxx test9.hxx test10.hxx test11.hxx test12.hxx test13.hxx \
test14.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -31,9 +28,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -41,7 +35,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -69,13 +67,11 @@ $(dist):
# Test.
#
-$(test): schemas := $(addprefix $(out_base)/,$(odb_hdr:.hxx=.sql))
-$(test): $(driver) $(src_base)/test.std
- $(call schema,$(schemas))
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule,,$(filter %.sql,$(gen))))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d,$(filter %.sql,$(gen)))))
+endif
# Clean.
#
@@ -83,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inheritance/reuse/makefile b/common/inheritance/reuse/makefile
index 874d48b..f240640 100644
--- a/common/inheritance/reuse/makefile
+++ b/common/inheritance/reuse/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inheritance/transient/makefile b/common/inheritance/transient/makefile
index f20894e..4d6ba4d 100644
--- a/common/inheritance/transient/makefile
+++ b/common/inheritance/transient/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inverse/makefile b/common/inverse/makefile
index a1c3202..89c98ee 100644
--- a/common/inverse/makefile
+++ b/common/inverse/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/lazy-ptr/makefile b/common/lazy-ptr/makefile
index cfb7010..03e39af 100644
--- a/common/lazy-ptr/makefile
+++ b/common/lazy-ptr/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-session \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/lifecycle/makefile b/common/lifecycle/makefile
index 3d700d9..f047e0f 100644
--- a/common/lifecycle/makefile
+++ b/common/lifecycle/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/makefile b/common/makefile
index ebf969a..44adcc7 100644
--- a/common/makefile
+++ b/common/makefile
@@ -57,10 +57,7 @@ cxx11_tests := session/custom
no_dist_tests := changelog include
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
+no_multi_tests := changelog include
$(default):
$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
@@ -72,6 +69,10 @@ ifeq ($(cxx_standard),c++11)
build_tests += $(cxx11_tests)
endif
+ifeq ($(db_id),common)
+build_tests := $(filter-out $(no_multi_tests),$(build_tests))
+endif
+
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests)))
name := common
@@ -89,6 +90,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests)))
$(call meta-vctest,$(name)-mysql-vc10.sln,test.bat)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(build_tests)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(build_tests))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_tests)))
$(call include,$(bld_root)/meta/vc9sln.make)
diff --git a/common/no-id/makefile b/common/no-id/makefile
index 439e883..99df92d 100644
--- a/common/no-id/makefile
+++ b/common/no-id/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/optimistic/makefile b/common/optimistic/makefile
index 8da011e..ac61e5a 100644
--- a/common/optimistic/makefile
+++ b/common/optimistic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/pragma/makefile b/common/pragma/makefile
index bb54f7a..1ea8ba1 100644
--- a/common/pragma/makefile
+++ b/common/pragma/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --table-prefix pragma_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,11 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -77,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/prepared/makefile b/common/prepared/makefile
index 72d0974..d905419 100644
--- a/common/prepared/makefile
+++ b/common/prepared/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/query/array/driver.cxx b/common/query/array/driver.cxx
index c449566..5b0d378 100644
--- a/common/query/array/driver.cxx
+++ b/common/query/array/driver.cxx
@@ -32,6 +32,7 @@ const odb::pgsql::database_type_id bt = odb::pgsql::id_bytea;
const odb::oracle::database_type_id bt = odb::oracle::id_raw;
#elif defined(DATABASE_MSSQL)
const odb::mssql::database_type_id bt = odb::mssql::id_binary;
+#elif defined(DATABASE_COMMON)
#else
# error unknown database
#endif
@@ -66,57 +67,78 @@ main (int argc, char* argv[])
// string
//
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == "abc")) == 1);
assert (size (db->query<object> (query::s == query::_val ("bcd"))) == 1);
assert (size (db->query<object> ("s = " + query::_val ("bcd"))) == 1);
assert (size (db->query<object> ("s = " + query::_ref ("bcd"))) == 1);
+#endif
{
char a[] = "bcd";
char* ra = a;
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == a)) == 1);
assert (size (db->query<object> (query::s == query::_val (a))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (ra))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (a))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (a))) == 1);
+#endif
}
{
const char a[] = "bcd";
const char* ra = a;
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == a)) == 1);
assert (size (db->query<object> (query::s == query::_val (a))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (ra))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (a))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (a))) == 1);
+#endif
}
{
const char* p = "cde";
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == p)) == 1);
assert (size (db->query<object> (query::s == query::_val (p))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (p))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (p))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (p))) == 1);
+#endif
}
{
char a[] = "cde";
char* p = a;
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == p)) == 1);
assert (size (db->query<object> (query::s == query::_val (p))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (p))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (p))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (p))) == 1);
+#endif
}
+#ifndef DATABASE_COMMON
string s ("abc");
//assert (size (db->query<object> (query::s == s)) == 1);
assert (size (db->query<object> (query::s == s.c_str ())) == 1);
//assert (size (db->query<object> (query::s == query::_val (s))) == 1);
assert (size (db->query<object> (query::s == query::_val (s.c_str ()))) == 1);
+
assert (size (db->query<object> ("s = " + query::_val (s))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (s))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::s1)) == 3);
@@ -126,12 +148,16 @@ main (int argc, char* argv[])
array<char, 17> a;
strcpy (a.data (), "abc");
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::a == a)) == 1);
assert (size (db->query<object> (query::a == query::_val (a))) == 1);
+#endif
assert (size (db->query<object> (query::a == query::_ref (a))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("a = " + query::_val (a))) == 1);
assert (size (db->query<object> ("a = " + query::_ref (a))) == 1);
#endif
+#endif
// char
//
@@ -141,18 +167,26 @@ main (int argc, char* argv[])
assert (size (db->query<object> (query::c == query::_val (c))) == 1);
assert (size (db->query<object> (query::c == query::_ref (c))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("c = " + query::_val ('c'))) == 1);
assert (size (db->query<object> ("c = " + query::_ref (c))) == 1);
+#endif
assert (size (db->query<object> (query::c == query::c1)) == 3);
// buffer
//
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::b == buf)) == 3);
assert (size (db->query<object> (query::b == query::_val (buf))) == 3);
+#endif
+
assert (size (db->query<object> (query::b == query::_ref (buf))) == 3);
+
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("b = " + query::_val<bt> (buf))) == 3);
assert (size (db->query<object> ("b = " + query::_ref<bt> (buf))) == 3);
+#endif
t.commit ();
}
diff --git a/common/query/array/makefile b/common/query/array/makefile
index 3708b9d..d8fa45b 100644
--- a/common/query/array/makefile
+++ b/common/query/array/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/query/array/test.hxx b/common/query/array/test.hxx
index e086a44..e9cbd15 100644
--- a/common/query/array/test.hxx
+++ b/common/query/array/test.hxx
@@ -46,6 +46,8 @@ struct object
# pragma db type("VARCHAR(16)")
# elif defined(ODB_DATABASE_SQLITE)
# pragma db type("TEXT")
+# elif defined(ODB_DATABASE_COMMON)
+# pragma db type("DYMMU") // Necessary to make it a value.
# else
# error unknown database
# endif
@@ -67,6 +69,7 @@ struct object
# pragma db type("RAW(16)")
# elif defined(ODB_DATABASE_MSSQL)
# pragma db type("BINARY(16)")
+# elif defined(ODB_DATABASE_COMMON)
# else
# error unknown database
# endif
diff --git a/common/query/basics/driver.cxx b/common/query/basics/driver.cxx
index ee8e3b1..be45237 100644
--- a/common/query/basics/driver.cxx
+++ b/common/query/basics/driver.cxx
@@ -48,6 +48,7 @@ main (int argc, char* argv[])
try
{
auto_ptr<database> db (create_database (argc, argv));
+ odb::database_id db_id (db->id ());
typedef odb::query<person> query;
typedef odb::result<person> result;
@@ -70,8 +71,13 @@ main (int argc, char* argv[])
t.commit ();
}
+ //
+ // Native queries.
+ //
+
// Compilation tests.
//
+#ifndef DATABASE_COMMON
if (false)
{
string name;
@@ -92,6 +98,7 @@ main (int argc, char* argv[])
query q1 (query::_val (name));
q1 += " = first";
}
+#endif
// Select-all query.
//
@@ -139,11 +146,13 @@ main (int argc, char* argv[])
cout << "test 003" << endl;
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- result r (db->query<person> ("age >= 30 AND last = 'Doe'"));
-#else
- result r (db->query<person> ("\"age\" >= 30 AND \"last\" = 'Doe'"));
-#endif
+
+ result r;
+ if (db_id != odb::id_oracle)
+ r = db->query<person> ("age >= 30 AND last = 'Doe'");
+ else
+ r = db->query<person> ("\"age\" >= 30 AND \"last\" = 'Doe'");
+
print (r);
t.commit ();
}
@@ -156,16 +165,22 @@ main (int argc, char* argv[])
const char* name = "Doe";
-#ifndef DATABASE_ORACLE
+#if defined(DATABASE_COMMON)
result r (
db->query<person> (
- "age >= " + query::_ref (30) + "AND" +
- "last = " + query::_val (name)));
-#else
+ query::age >= query::_val (30) &&
+ query::last_name == query::_val (name)));
+
+#elif defined(DATABASE_ORACLE)
result r (
db->query<person> (
- "\"age\" >= " + query::_ref (30) + "AND" +
+ "\"age\" >= " + query::_val (30) + "AND" +
"\"last\" = " + query::_val (name)));
+#else
+ result r (
+ db->query<person> (
+ "age >= " + query::_val (30) + "AND" +
+ "last = " + query::_val (name)));
#endif
print (r);
@@ -181,12 +196,15 @@ main (int argc, char* argv[])
string name;
unsigned short age;
-#ifndef DATABASE_ORACLE
- query q ("age >= " + query::_ref (age) + "AND" +
- "last = " + query::_ref (name));
-#else
+#if defined(DATABASE_COMMON)
+ query q (query::age >= query::_ref (age) &&
+ query::last_name == query::_ref (name));
+#elif defined(DATABASE_ORACLE)
query q ("\"age\" >= " + query::_ref (age) + "AND" +
"\"last\" = " + query::_ref (name));
+#else
+ query q ("age >= " + query::_ref (age) + "AND" +
+ "last = " + query::_ref (name));
#endif
name = "Doe";
@@ -232,7 +250,9 @@ main (int argc, char* argv[])
//db->query<person> (query::age == query::_ref (name));
db->query<person> (query::last_name == "Doe");
db->query<person> (query::last_name == name);
+#ifndef DATABASE_COMMON
db->query<person> (query::last_name == query::_val ("Doe"));
+#endif
db->query<person> (query::last_name == query::_val (name));
db->query<person> (query::last_name == query::_ref (name));
//db->query<person> (query::last_name == 30);
@@ -437,9 +457,8 @@ main (int argc, char* argv[])
// SQL Server does not support re-loading of an object with long data
// from a query result.
//
-#ifndef DATABASE_MSSQL
- assert (i->last_name_ == "Doe"); // Actual load.
-#endif
+ if (db_id != odb::id_mssql)
+ assert (i->last_name_ == "Doe"); // Actual load.
// Overwrite object image again.
//
@@ -470,18 +489,22 @@ main (int argc, char* argv[])
result r;
result::iterator i;
+ // ==
+ //
+
// Oracle does not support LOB comparisons.
//
#ifndef DATABASE_ORACLE
- // ==
- //
- r = db->query<person> (query::public_key == key2);
+ if (db_id != odb::id_oracle)
+ {
+ r = db->query<person> (query::public_key == key2);
- i = r.begin ();
- assert (i != r.end ());
+ i = r.begin ();
+ assert (i != r.end ());
- assert (*i->public_key_ == key2);
- assert (++i == r.end ());
+ assert (*i->public_key_ == key2);
+ assert (++i == r.end ());
+ }
#endif
// is_null
@@ -549,9 +572,9 @@ main (int argc, char* argv[])
// Test size() validity at the beginning/middle/end of result set.
//
cout << "test 019" << endl;
-#if !defined(DATABASE_SQLITE) && \
- !defined(DATABASE_ORACLE) && \
- !defined(DATABASE_MSSQL)
+ if (db_id != odb::id_sqlite &&
+ db_id != odb::id_oracle &&
+ db_id != odb::id_mssql)
{
{
transaction t (db->begin ());
@@ -600,7 +623,6 @@ main (int argc, char* argv[])
assert (r.size () == 0);
}
}
-#endif
// Test like.
//
@@ -619,11 +641,11 @@ main (int argc, char* argv[])
// In Oracle one can only escape special characters (% and _).
//
-#if defined(DATABASE_ORACLE)
- string v ("Ja%");
-#else
- string v ("!Ja%");
-#endif
+ string v;
+ if (db_id != odb::id_oracle)
+ v = "!Ja%";
+ else
+ v = "Ja%";
r = db->query<person> (query::first_name.like (query::_ref (v), "!"));
print (r);
diff --git a/common/query/basics/makefile b/common/query/basics/makefile
index ec63728..fc26133 100644
--- a/common/query/basics/makefile
+++ b/common/query/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/readonly/driver.cxx b/common/readonly/driver.cxx
index e97a0cb..2bb7ce9 100644
--- a/common/readonly/driver.cxx
+++ b/common/readonly/driver.cxx
@@ -14,6 +14,7 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
+#include <common/config.hxx> // DATABASE_*
#include <common/common.hxx>
#include "test.hxx"
@@ -204,6 +205,7 @@ main (int argc, char* argv[])
// Readonly object.
//
{
+#ifndef DATABASE_COMMON
typedef odb::object_traits_impl<simple_object, odb::id_common> so_traits;
typedef odb::object_traits_impl<ro_object, odb::id_common> ro_traits;
typedef odb::object_traits_impl<rw_object, odb::id_common> rw_traits;
@@ -216,6 +218,7 @@ main (int argc, char* argv[])
assert (rw_traits::column_count !=
rw_traits::id_column_count + rw_traits::readonly_column_count);
+#endif
simple_object so (1, 1);
ro_object ro_o (1, 1);
diff --git a/common/readonly/makefile b/common/readonly/makefile
index 3c586bd..92bc2cf 100644
--- a/common/readonly/makefile
+++ b/common/readonly/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/relationship-query/makefile b/common/relationship-query/makefile
index 56994b5..caf72ea 100644
--- a/common/relationship-query/makefile
+++ b/common/relationship-query/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/relationship/makefile b/common/relationship/makefile
index c469a93..95ad959 100644
--- a/common/relationship/makefile
+++ b/common/relationship/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/embedded/basics/driver.cxx b/common/schema/embedded/basics/driver.cxx
index 5a14149..a67529c 100644
--- a/common/schema/embedded/basics/driver.cxx
+++ b/common/schema/embedded/basics/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test.hxx"
@@ -36,9 +35,8 @@ main (int argc, char* argv[])
// Temporarily disable foreign key constraints for SQLite.
//
-#if defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=OFF");
-#endif
+ if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
assert (schema_catalog::exists (*db, "test"));
assert (!schema_catalog::exists (*db, "test1"));
@@ -48,9 +46,8 @@ main (int argc, char* argv[])
schema_catalog::create_schema (*db, "test");
t.commit ();
-#if defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=ON");
-#endif
+ if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
}
}
catch (const odb::exception& e)
diff --git a/common/schema/embedded/basics/makefile b/common/schema/embedded/basics/makefile
index 96e987a..07a246f 100644
--- a/common/schema/embedded/basics/makefile
+++ b/common/schema/embedded/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,11 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/embedded/order/driver.cxx b/common/schema/embedded/order/driver.cxx
index 685693d..0545442 100644
--- a/common/schema/embedded/order/driver.cxx
+++ b/common/schema/embedded/order/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test1.hxx"
@@ -31,6 +30,7 @@ main (int argc, char* argv[])
try
{
auto_ptr<database> db (create_database (argc, argv, false));
+ odb::database_id db_id (db->id ());
// Create the database schema.
//
@@ -41,21 +41,19 @@ main (int argc, char* argv[])
// For MySQL we can actually create the tables in any order. It is
// dropping them that's the problem (there is no IF EXISTS).
//
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=0");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=OFF");
-#endif
+ if (db_id == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=0");
+ else if (db_id == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
transaction t (c->begin ());
schema_catalog::create_schema (*db);
t.commit ();
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=1");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=ON");
-#endif
+ if (db_id == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=1");
+ else if (db_id == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
}
}
catch (const odb::exception& e)
diff --git a/common/schema/embedded/order/makefile b/common/schema/embedded/order/makefile
index e8897d5..10242cf 100644
--- a/common/schema/embedded/order/makefile
+++ b/common/schema/embedded/order/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test2.hxx test1.hxx # Reverse order.
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -43,7 +37,11 @@ $(gen): $(common.l.cpp-options)
#
$(gen): $(addprefix $(src_base)/,$(odb_hdr))
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -71,11 +69,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -83,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/namespace/makefile b/common/schema/namespace/makefile
index 38f6be1..8d34d43 100644
--- a/common/schema/namespace/makefile
+++ b/common/schema/namespace/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/namespace/test.hxx b/common/schema/namespace/test.hxx
index 351b574..dfaaf19 100644
--- a/common/schema/namespace/test.hxx
+++ b/common/schema/namespace/test.hxx
@@ -92,6 +92,8 @@ struct type
# define DB_SCHEMA ""
#elif defined(ODB_DATABASE_MSSQL)
# define DB_SCHEMA "dbo"
+#elif defined(ODB_DATABASE_COMMON)
+# define DB_SCHEMA "dummy"
#else
# error unknown database
#endif
diff --git a/common/session/cache/makefile b/common/session/cache/makefile
index 3219565..165a7b3 100644
--- a/common/session/cache/makefile
+++ b/common/session/cache/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-session \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/session/custom/makefile b/common/session/custom/makefile
index 2342b04..da19443 100644
--- a/common/session/custom/makefile
+++ b/common/session/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx session.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -40,7 +34,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-session \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -68,12 +66,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -81,7 +78,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/template/makefile b/common/template/makefile
index 0d8cf60..2498cce 100644
--- a/common/template/makefile
+++ b/common/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/threads/driver.cxx b/common/threads/driver.cxx
index 0714d4a..3114072 100644
--- a/common/threads/driver.cxx
+++ b/common/threads/driver.cxx
@@ -17,10 +17,10 @@
#include <odb/details/shared-ptr.hxx>
#include <odb/details/thread.hxx>
-#include <common/config.hxx> // DATABASE_SQLITE
+#include <common/config.hxx> // DATABASE_*
#include <common/common.hxx>
-#ifdef DATABASE_SQLITE
+#if defined(DATABASE_SQLITE) || defined(DATABASE_COMMON)
# include <odb/sqlite/database.hxx>
#endif
@@ -70,7 +70,7 @@ struct task
{
try
{
-#ifndef DATABASE_SQLITE
+#if !defined(DATABASE_SQLITE) && !defined(DATABASE_COMMON)
transaction t (db_.begin ());
#else
// SQLite has a peculiar table locking mode (shared cache)
@@ -79,10 +79,16 @@ struct task
// perspective. One way to work around this problem is to
// start a "write" transaction as such right away.
//
- transaction t (
- static_cast<odb::sqlite::database&> (db_).begin_immediate ());
-#endif
+ transaction t;
+ if (db_.id () != odb::id_sqlite)
+ t.reset (db_.begin ());
+ else
+ {
+ t.reset (
+ static_cast<odb::sqlite::database&> (db_).begin_immediate ());
+ }
+#endif
auto_ptr<object> o (db_.load<object> (id));
assert (o->str_ == "first object");
o->str_ = "another value";
diff --git a/common/threads/makefile b/common/threads/makefile
index 91adc8d..92d00d7 100644
--- a/common/threads/makefile
+++ b/common/threads/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/transaction/basics/makefile b/common/transaction/basics/makefile
index a399e8c..07b1ba6 100644
--- a/common/transaction/basics/makefile
+++ b/common/transaction/basics/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -46,11 +41,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
diff --git a/common/transaction/callback/makefile b/common/transaction/callback/makefile
index e60c936..012dd2f 100644
--- a/common/transaction/callback/makefile
+++ b/common/transaction/callback/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -46,11 +41,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
diff --git a/common/types/makefile b/common/types/makefile
index f47e4d4..c28964a 100644
--- a/common/types/makefile
+++ b/common/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --table-prefix types_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,11 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -77,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/view/driver.cxx b/common/view/driver.cxx
index b8a8f3e..2c5c65c 100644
--- a/common/view/driver.cxx
+++ b/common/view/driver.cxx
@@ -58,11 +58,11 @@ view2_test (const auto_ptr<database>& db)
}
{
-#ifndef DATABASE_ORACLE
- result r (db->query<V> ("age < 31"));
-#else
- result r (db->query<V> ("\"age\" < 31"));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<V> ("age < 31");
+ else
+ r = db->query<V> ("\"age\" < 31");
iterator i (r.begin ());
assert (i != r.end ());
@@ -90,11 +90,11 @@ view4_test (const auto_ptr<database>& db)
transaction t (db->begin ());
{
-#ifndef DATABASE_ORACLE
- result r (db->query<V> ((query::person::age > 30) + "ORDER BY age"));
-#else
- result r (db->query<V> ((query::person::age > 30) + "ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<V> ((query::person::age > 30) + "ORDER BY age");
+ else
+ r = db->query<V> ((query::person::age > 30) + "ORDER BY \"age\"");
iterator i (r.begin ());
@@ -237,20 +237,22 @@ main (int argc, char* argv[])
}
{
-#ifndef DATABASE_ORACLE
- result r (db->query<view1> ("ORDER BY age"));
-#else
- result r (db->query<view1> ("ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1> ("ORDER BY age");
+ else
+ r = db->query<view1> ("ORDER BY \"age\"");
+
assert (size (r) == 4);
}
{
-#ifndef DATABASE_ORACLE
- result r (db->query<view1> ("age < 31 ORDER BY age"));
-#else
- result r (db->query<view1> ("\"age\" < 31 ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1> ("age < 31 ORDER BY age");
+ else
+ r = db->query<view1> ("\"age\" < 31 ORDER BY \"age\"");
+
view1_check (r);
}
@@ -289,6 +291,9 @@ main (int argc, char* argv[])
t.commit ();
}
+ // No native parameter support in dynamic multi-database mode.
+ //
+#ifndef DATABASE_COMMON
{
transaction t (db->begin ());
@@ -306,6 +311,7 @@ main (int argc, char* argv[])
t.commit ();
}
+#endif
}
}
@@ -317,20 +323,15 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- result r (
- db->query<view1c> (
- "SELECT first, last, age "
- "FROM t_view_person "
- "WHERE age < 31 ORDER BY age"));
-#else
- result r (
- db->query<view1c> (
- "SELECT \"first\", \"last\", \"age\" "
- "FROM \"t_view_person\" "
- "WHERE \"age\" < 31 ORDER BY \"age\""));
-#endif
-
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1c> ("SELECT first, last, age "
+ "FROM t_view_person "
+ "WHERE age < 31 ORDER BY age");
+ else
+ r = db->query<view1c> ("SELECT \"first\", \"last\", \"age\" "
+ "FROM \"t_view_person\" "
+ "WHERE \"age\" < 31 ORDER BY \"age\"");
view1_check (r);
t.commit ();
@@ -346,11 +347,12 @@ main (int argc, char* argv[])
transaction t (db->begin ());
{
-#ifndef DATABASE_ORACLE
- result r (db->query<view1d> ("age < 31 ORDER BY age"));
-#else
- result r (db->query<view1d> ("\"age\" < 31 ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1d> ("age < 31 ORDER BY age");
+ else
+ r = db->query<view1d> ("\"age\" < 31 ORDER BY \"age\"");
+
view1_check (r);
}
@@ -466,12 +468,16 @@ main (int argc, char* argv[])
view6_test<view6b> (
db, odb::query<view6b>::employer::name == "Simple Tech, Inc");
+ // No native parameter support in dynamic multi-database mode.
+ //
+#ifndef DATABASE_COMMON
view6_test<view6c> (
#ifndef DATABASE_ORACLE
db, "e.name = " + odb::query<view6c>::_val ("Simple Tech, Inc"));
#else
db, "\"e\".\"name\" = " + odb::query<view6c>::_val ("Simple Tech, Inc"));
#endif
+#endif
// view7
//
diff --git a/common/view/makefile b/common/view/makefile
index 6aad221..d13e7c6 100644
--- a/common/view/makefile
+++ b/common/view/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/virtual/makefile b/common/virtual/makefile
index 168c969..ef27eff 100644
--- a/common/virtual/makefile
+++ b/common/virtual/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/wrapper/makefile b/common/wrapper/makefile
index 68492c1..1c2cd3f 100644
--- a/common/wrapper/makefile
+++ b/common/wrapper/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix wrapper_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/evolution/add-column/makefile b/evolution/add-column/makefile
index 7da8b71..9c397b9 100644
--- a/evolution/add-column/makefile
+++ b/evolution/add-column/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/add-foreign-key/makefile b/evolution/add-foreign-key/makefile
index 3446e5b..295598f 100644
--- a/evolution/add-foreign-key/makefile
+++ b/evolution/add-foreign-key/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -76,7 +67,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -114,7 +104,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/add-index/makefile b/evolution/add-index/makefile
index 50a6673..07b817b 100644
--- a/evolution/add-index/makefile
+++ b/evolution/add-index/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/add-table/makefile b/evolution/add-table/makefile
index a57e56e..88c4cde 100644
--- a/evolution/add-table/makefile
+++ b/evolution/add-table/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/alter-column/makefile b/evolution/alter-column/makefile
index 998c915..bbfa0bf 100644
--- a/evolution/alter-column/makefile
+++ b/evolution/alter-column/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/combined/makefile b/evolution/combined/makefile
index 33c5176..f49d1a7 100644
--- a/evolution/combined/makefile
+++ b/evolution/combined/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/data/makefile b/evolution/data/makefile
index 6787527..8023594 100644
--- a/evolution/data/makefile
+++ b/evolution/data/makefile
@@ -6,17 +6,20 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,18 +32,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -73,7 +64,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -111,7 +101,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
# Generated .gitignore.
diff --git a/evolution/drop-column/makefile b/evolution/drop-column/makefile
index 26b31ac..244181c 100644
--- a/evolution/drop-column/makefile
+++ b/evolution/drop-column/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/drop-foreign-key/makefile b/evolution/drop-foreign-key/makefile
index 78d1602..9a12aa8 100644
--- a/evolution/drop-foreign-key/makefile
+++ b/evolution/drop-foreign-key/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -76,7 +67,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -114,7 +104,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/drop-index/makefile b/evolution/drop-index/makefile
index 2e849c1..5d90d38 100644
--- a/evolution/drop-index/makefile
+++ b/evolution/drop-index/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/drop-table/makefile b/evolution/drop-table/makefile
index ff6014f..99339d7 100644
--- a/evolution/drop-table/makefile
+++ b/evolution/drop-table/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/embedded/makefile b/evolution/embedded/makefile
index 8503ce7..3639f85 100644
--- a/evolution/embedded/makefile
+++ b/evolution/embedded/makefile
@@ -6,17 +6,20 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,18 +32,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -73,7 +64,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -103,7 +93,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
# Generated .gitignore.
diff --git a/evolution/makefile b/evolution/makefile
index d83995e..fddde1b 100644
--- a/evolution/makefile
+++ b/evolution/makefile
@@ -20,11 +20,6 @@ version \
data \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
all_tests := $(tests)
build_tests := $(tests)
diff --git a/evolution/template/makefile b/evolution/template/makefile
index 88bf49a..c7777b1 100644
--- a/evolution/template/makefile
+++ b/evolution/template/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/evolution/version/makefile b/evolution/version/makefile
index bcb4819..63bbe72 100644
--- a/evolution/version/makefile
+++ b/evolution/version/makefile
@@ -6,17 +6,22 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
+gen1 := $(addprefix $(out_base)/,$(genf1))
+genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
+gen2 := $(addprefix $(out_base)/,$(genf2))
+genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
+gen3 := $(addprefix $(out_base)/,$(genf3))
+genf := $(genf1) $(genf2) $(genf3)
+gen := $(gen1) $(gen2) $(gen3)
+gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
+test3-003-pre.sql test3-003-post.sql
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,20 +34,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf1 := test1-odb.hxx test1-odb.ixx test1-odb.cxx
-gen1 := $(addprefix $(out_base)/,$(genf1))
-
-genf2 := test2-odb.hxx test2-odb.ixx test2-odb.cxx
-gen2 := $(addprefix $(out_base)/,$(genf2))
-
-genf3 := test3-odb.hxx test3-odb.ixx test3-odb.cxx
-gen3 := $(addprefix $(out_base)/,$(genf3))
-
-genf := $(genf1) $(genf2) $(genf3)
-gen := $(gen1) $(gen2) $(gen3)
-gens := test1.sql test2.sql test3.sql test3-002-pre.sql test3-002-post.sql \
-test3-003-pre.sql test3-003-post.sql
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): odb_common_options = --generate-query \
@@ -75,7 +66,6 @@ $(out_base)/: $(driver)
#
name := $(subst /,-,$(subst $(src_root)/evolution/,,$(src_base)))
-
$(dist): sources := $(cxx_tun)
$(dist): headers := $(odb_hdr)
$(dist): export extra_headers := model.hxx
@@ -113,7 +103,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/model.xml) # Changelog.
$(call message,,rm -f $(out_base)/test3-*.sql) # Migration files.
diff --git a/libcommon/common/common.cxx b/libcommon/common/common.cxx
index 65fbcfe..4ca2b68 100644
--- a/libcommon/common/common.cxx
+++ b/libcommon/common/common.cxx
@@ -6,80 +6,26 @@
#include <utility> // std::move
#include <iostream>
-#include <common/config.hxx>
-
#include <odb/database.hxx>
-#if defined(DATABASE_MYSQL)
-# include <odb/mysql/database.hxx>
-# include <odb/mysql/connection-factory.hxx>
-#elif defined(DATABASE_SQLITE)
-# include <odb/connection.hxx>
-# include <odb/transaction.hxx>
-# include <odb/schema-catalog.hxx>
-# include <odb/sqlite/database.hxx>
-# include <odb/sqlite/connection-factory.hxx>
-#elif defined(DATABASE_PGSQL)
-# include <odb/pgsql/database.hxx>
-# include <odb/pgsql/connection-factory.hxx>
-#elif defined(DATABASE_ORACLE)
-# include <odb/oracle/database.hxx>
-# include <odb/oracle/connection-factory.hxx>
-#elif defined(DATABASE_MSSQL)
-# include <odb/mssql/database.hxx>
-# include <odb/mssql/connection-factory.hxx>
-#else
-# error unknown database
-#endif
-
+#include <common/config.hxx>
#include <common/common.hxx>
using namespace std;
using namespace odb::core;
-#if defined(DATABASE_MYSQL)
-namespace mysql = odb::mysql;
-#elif defined(DATABASE_SQLITE)
-namespace sqlite = odb::sqlite;
-#elif defined(DATABASE_PGSQL)
-namespace pgsql = odb::pgsql;
-#elif defined(DATABASE_ORACLE)
-namespace oracle = odb::oracle;
-#elif defined(DATABASE_MSSQL)
-namespace mssql = odb::mssql;
-#endif
-
-auto_ptr<database>
-create_database (int& argc,
- char* argv[],
-#if defined(DATABASE_SQLITE)
- bool schema,
-#else
- bool,
-#endif
- size_t max_connections)
-{
- if (argc > 1 && argv[1] == string ("--help"))
- {
- cout << "Usage: " << argv[0] << " [options]" << endl
- << "Options:" << endl;
-
-#if defined(DATABASE_MYSQL)
- mysql::database::print_usage (cout);
-#elif defined(DATABASE_SQLITE)
- sqlite::database::print_usage (cout);
-#elif defined(DATABASE_PGSQL)
- pgsql::database::print_usage (cout);
-#elif defined(DATABASE_ORAClE)
- oracle::database::print_usage (cout);
-#endif
- exit (0);
- }
+// MySQL.
+//
+#if defined(DATABASE_MYSQL) || defined(DATABASE_COMMON)
- auto_ptr<database> db;
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/connection-factory.hxx>
-#if defined(DATABASE_MYSQL)
+static auto_ptr<database>
+create_mysql_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace mysql = odb::mysql;
#ifdef HAVE_CXX11
unique_ptr<mysql::connection_factory> f;
@@ -90,15 +36,35 @@ create_database (int& argc,
if (max_connections != 0)
f.reset (new mysql::connection_pool_factory (max_connections));
- db.reset (new mysql::database (argc, argv, false, "", 0,
+ return auto_ptr<database> (
+ new mysql::database (argc, argv, false, "", 0,
#ifdef HAVE_CXX11
- move (f)
+ move (f)
#else
- f
+ f
#endif
- ));
+ ));
+}
+#endif // MySQL
-#elif defined(DATABASE_SQLITE)
+
+// SQLite.
+//
+#if defined(DATABASE_SQLITE) || defined(DATABASE_COMMON)
+
+#include <odb/connection.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/connection-factory.hxx>
+
+static auto_ptr<database>
+create_sqlite_database (int& argc,
+ char* argv[],
+ bool schema,
+ size_t max_connections)
+{
+ namespace sqlite = odb::sqlite;
#ifdef HAVE_CXX11
unique_ptr<sqlite::connection_factory> f;
@@ -109,7 +75,7 @@ create_database (int& argc,
if (max_connections != 0)
f.reset (new sqlite::connection_pool_factory (max_connections));
- db.reset (
+ auto_ptr<database> db (
new sqlite::database (
argc, argv, false,
SQLITE_OPEN_READWRITE
@@ -144,7 +110,22 @@ create_database (int& argc,
c->execute ("PRAGMA foreign_keys=ON");
}
-#elif defined(DATABASE_PGSQL)
+ return db;
+}
+#endif // SQLite
+
+
+// PostgreSQL.
+//
+#if defined(DATABASE_PGSQL) || defined(DATABASE_COMMON)
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/connection-factory.hxx>
+
+static auto_ptr<database>
+create_pgsql_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace pgsql = odb::pgsql;
#ifdef HAVE_CXX11
unique_ptr<pgsql::connection_factory> f;
@@ -155,15 +136,29 @@ create_database (int& argc,
if (max_connections != 0)
f.reset (new pgsql::connection_pool_factory (max_connections));
- db.reset (new pgsql::database (argc, argv, false, "",
+ return auto_ptr<database> (
+ new pgsql::database (argc, argv, false, "",
#ifdef HAVE_CXX11
- move (f)
+ move (f)
#else
- f
+ f
#endif
- ));
+ ));
+}
+#endif // PostgreSQL
-#elif defined(DATABASE_ORACLE)
+
+// Oracle.
+//
+#if defined(DATABASE_ORACLE) || defined(DATABASE_COMMON)
+
+#include <odb/oracle/database.hxx>
+#include <odb/oracle/connection-factory.hxx>
+
+static auto_ptr<database>
+create_oracle_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace oracle = odb::oracle;
#ifdef HAVE_CXX11
unique_ptr<oracle::connection_factory> f;
@@ -177,15 +172,28 @@ create_database (int& argc,
// Set client database character set and client national character set
// to UTF-8.
//
- db.reset (new oracle::database (argc, argv, false, 873, 873, 0,
+ return auto_ptr<database> (
+ new oracle::database (argc, argv, false, 873, 873, 0,
#ifdef HAVE_CXX11
- move (f)
+ move (f)
#else
- f
+ f
#endif
- ));
+ ));
+}
+#endif // Oracle
-#elif defined(DATABASE_MSSQL)
+// SQL Server.
+//
+#if defined(DATABASE_MSSQL) || defined(DATABASE_COMMON)
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/connection-factory.hxx>
+
+static auto_ptr<database>
+create_mssql_database (int& argc, char* argv[], bool, size_t max_connections)
+{
+ namespace mssql = odb::mssql;
#ifdef HAVE_CXX11
unique_ptr<mssql::connection_factory> f;
@@ -196,18 +204,147 @@ create_database (int& argc,
if (max_connections != 0)
f.reset (new mssql::connection_pool_factory (max_connections));
- db.reset (new mssql::database (argc, argv, false, "",
- mssql::isolation_read_committed, 0,
+ return auto_ptr<database> (
+ new mssql::database (argc, argv, false, "",
+ mssql::isolation_read_committed, 0,
#ifdef HAVE_CXX11
- move (f)
+ move (f)
#else
- f
+ f
#endif
- ));
+ ));
+}
+#endif // SQL Server
+
+//
+//
+auto_ptr<database>
+create_database (int argc,
+ char* argv[],
+ bool schema,
+ size_t max_connections,
+#if defined(DATABASE_COMMON)
+ odb::database_id db
+#else
+ odb::database_id
#endif
+)
+{
+ char** argp (argv + 1); // Position of the next argument.
+ int argn (argc - 1); // Number of arguments left.
- return db;
+#if defined(DATABASE_COMMON)
+ // Figure out which database we are creating. We may be given the
+ // database name as a program argument or as an id.
+ //
+ if (db == odb::id_common && argn != 0)
+ {
+ string s (*argp);
+
+ if (s == "mysql")
+ db = odb::id_mysql;
+ else if (s == "sqlite")
+ db = odb::id_sqlite;
+ else if (s == "pgsql")
+ db = odb::id_pgsql;
+ else if (s == "oracle")
+ db = odb::id_oracle;
+ else if (s == "mssql")
+ db = odb::id_mssql;
+
+ if (db != odb::id_common)
+ {
+ argp++;
+ argn--;
+ }
+ }
+
+ if (db == odb::id_common)
+ {
+ cerr << "Usage: " << argv[0] << " <db> [options]" << endl;
+ exit (1);
+ }
+#endif
+
+ if (argn != 0 && *argp == string ("--help"))
+ {
+#if defined(DATABASE_COMMON)
+ cout << "Usage: " << argv[0] << " <db> [options]" << endl;
+#else
+ cout << "Usage: " << argv[0] << " [options]" << endl;
+#endif
+
+ cout << "Options:" << endl;
+
+#if defined(DATABASE_MYSQL)
+ odb::mysql::database::print_usage (cout);
+#elif defined(DATABASE_SQLITE)
+ odb::sqlite::database::print_usage (cout);
+#elif defined(DATABASE_PGSQL)
+ odb::pgsql::database::print_usage (cout);
+#elif defined(DATABASE_ORACLE)
+ odb::oracle::database::print_usage (cout);
+#elif defined(DATABASE_MSSQL)
+ odb::mssql::database::print_usage (cout);
+#elif defined(DATABASE_COMMON)
+ switch (db)
+ {
+ case odb::id_mysql:
+ odb::mysql::database::print_usage (cout);
+ break;
+ case odb::id_sqlite:
+ odb::sqlite::database::print_usage (cout);
+ break;
+ case odb::id_pgsql:
+ odb::pgsql::database::print_usage (cout);
+ break;
+ case odb::id_oracle:
+ odb::oracle::database::print_usage (cout);
+ break;
+ case odb::id_mssql:
+ odb::mssql::database::print_usage (cout);
+ break;
+ case odb::id_common:
+ assert (false);
+ }
+#else
+# error unknown database
+#endif
+
+ exit (0);
+ }
+
+#if defined(DATABASE_MYSQL)
+ return create_mysql_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_SQLITE)
+ return create_sqlite_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_PGSQL)
+ return create_pgsql_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_ORACLE)
+ return create_oracle_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_MSSQL)
+ return create_mssql_database (argc, argv, schema, max_connections);
+#elif defined(DATABASE_COMMON)
+ switch (db)
+ {
+ case odb::id_mysql:
+ return create_mysql_database (argc, argv, schema, max_connections);
+ case odb::id_sqlite:
+ return create_sqlite_database (argc, argv, schema, max_connections);
+ case odb::id_pgsql:
+ return create_pgsql_database (argc, argv, schema, max_connections);
+ case odb::id_oracle:
+ return create_oracle_database (argc, argv, schema, max_connections);
+ case odb::id_mssql:
+ return create_mssql_database (argc, argv, schema, max_connections);
+ case odb::id_common:
+ assert (false);
+ }
+ return auto_ptr<database> ();
+#else
+# error unknown database
+#endif
}
bool
@@ -215,7 +352,8 @@ size_available ()
{
#if defined(DATABASE_SQLITE) || \
defined(DATABASE_ORACLE) || \
- defined(DATABASE_MSSQL)
+ defined(DATABASE_MSSQL) || \
+ defined(DATABASE_COMMON)
return false;
#else
return true;
diff --git a/libcommon/common/common.hxx b/libcommon/common/common.hxx
index 114dbdd..f9bbd4d 100644
--- a/libcommon/common/common.hxx
+++ b/libcommon/common/common.hxx
@@ -20,20 +20,25 @@
#endif
LIBCOMMON_EXPORT std::auto_ptr<odb::database>
-create_database (int& argc,
+create_database (int argc,
char* argv[],
bool create_schema = true,
- std::size_t max_connections = 0);
+ std::size_t max_connections = 0,
+ odb::database_id db = odb::id_common);
template <typename T>
std::auto_ptr<T>
-create_specific_database (int& argc,
+create_specific_database (int argc,
char* argv[],
bool create_schema = true,
std::size_t max_connections = 0)
{
std::auto_ptr<odb::database> r (
- create_database (argc, argv, create_schema, max_connections));
+ create_database (argc, argv,
+ create_schema,
+ max_connections,
+ T::database_id));
+
return std::auto_ptr<T> (&dynamic_cast<T&> (*r.release ()));
}
diff --git a/libcommon/common/concrete.hxx b/libcommon/common/concrete.hxx
index 3141ba4..5c28b63 100644
--- a/libcommon/common/concrete.hxx
+++ b/libcommon/common/concrete.hxx
@@ -44,6 +44,15 @@ namespace odb_db = odb::oracle;
namespace odb_db = odb::mssql;
+#elif defined(DATABASE_COMMON)
+
+// Fallback to common interface.
+//
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+namespace odb_db = odb;
+
#endif
#endif // LIBCOMMON_COMMON_CONCRETE_HXX
diff --git a/libcommon/common/makefile b/libcommon/common/makefile
index 53df875..5d23fa9 100644
--- a/libcommon/common/makefile
+++ b/libcommon/common/makefile
@@ -12,10 +12,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_base)/common.l
common.l.cpp-options := $(out_base)/common.l.cpp-options
-default := $(out_base)/
-dist := $(out_base)/.dist
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -23,9 +19,47 @@ $(call import,\
l: odb.l,cpp-options: odb.l.cpp-options)
ifdef db_id
+ifneq ($(db_id),common)
$(call import,\
$(scf_root)/import/libodb-$(db_id)/stub.make,\
l: odb_db.l,cpp-options: odb_db.l.cpp-options)
+else
+# Import all database runtimes.
+#
+$(call import,\
+ $(scf_root)/import/libodb-mysql/stub.make,\
+ l: odb_mysql.l,cpp-options: odb_mysql.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libodb-sqlite/stub.make,\
+ l: odb_sqlite.l,cpp-options: odb_sqlite.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libodb-pgsql/stub.make,\
+ l: odb_pgsql.l,cpp-options: odb_pgsql.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libodb-oracle/stub.make,\
+ l: odb_oracle.l,cpp-options: odb_oracle.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libodb-mssql/stub.make,\
+ l: odb_mssql.l,cpp-options: odb_mssql.l.cpp-options)
+
+odb_db.l := \
+$(odb_mysql.l) \
+$(odb_sqlite.l) \
+$(odb_pgsql.l) \
+$(odb_oracle.l) \
+$(odb_mssql.l)
+
+odb_db.l.cpp-options := \
+$(odb_mysql.l.cpp-options) \
+$(odb_sqlite.l.cpp-options) \
+$(odb_pgsql.l.cpp-options) \
+$(odb_oracle.l.cpp-options) \
+$(odb_mssql.l.cpp-options)
+endif
endif
ifeq ($(odb_db.l.cpp-options),)
@@ -62,6 +96,8 @@ else ifeq ($(db_id),oracle)
@echo '#define DATABASE_ORACLE 1' >>$@
else ifeq ($(db_id),mssql)
@echo '#define DATABASE_MSSQL 1' >>$@
+else ifeq ($(db_id),common)
+ @echo '#define DATABASE_COMMON 1' >>$@
endif
ifeq ($(cxx_standard),c++11)
@echo '#define HAVE_CXX11 1' >>$@
diff --git a/libcommon/makefile b/libcommon/makefile
index 9d9b6e9..cade0e7 100644
--- a/libcommon/makefile
+++ b/libcommon/makefile
@@ -6,10 +6,6 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
dirs := common
-default := $(out_base)/
-dist := $(out_base)/.dist
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs)))
$(dist): export dirs := $(dirs)
diff --git a/makefile b/makefile
index 99c61e7..63a3982 100644
--- a/makefile
+++ b/makefile
@@ -5,13 +5,14 @@
include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make
all_dirs := libcommon common evolution mysql sqlite pgsql oracle mssql boost qt
-dirs := common evolution boost qt
-dirs += $(db_id)
+dirs := common boost qt
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
+# Evolution and database-specific tests are not run in the multi-database
+# configuration.
+#
+ifneq ($(db_id),common)
+dirs += evolution $(db_id)
+endif
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs)))
@@ -32,6 +33,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_dirs)))
$(call meta-autoconf)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(dirs)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(dirs))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_dirs)))
$(call include,$(bld_root)/dist.make)
diff --git a/mssql/custom/makefile b/mssql/custom/makefile
index 9acc2f5..98c0869 100644
--- a/mssql/custom/makefile
+++ b/mssql/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx traits.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --default-database \
@@ -66,12 +60,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mssql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -79,7 +68,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mssql/database/makefile b/mssql/database/makefile
index e1bf4ba..b8281c5 100644
--- a/mssql/database/makefile
+++ b/mssql/database/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/mssql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/mssql/makefile b/mssql/makefile
index df8e9c1..4891a0a 100644
--- a/mssql/makefile
+++ b/mssql/makefile
@@ -12,11 +12,6 @@ native \
query \
types
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := mssql
diff --git a/mssql/native/makefile b/mssql/native/makefile
index 24d88ae..95fbd77 100644
--- a/mssql/native/makefile
+++ b/mssql/native/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/mssql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/mssql/query/makefile b/mssql/query/makefile
index 6f7106e..6194671 100644
--- a/mssql/query/makefile
+++ b/mssql/query/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --default-database \
@@ -64,12 +58,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mssql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -77,7 +66,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mssql/template/makefile b/mssql/template/makefile
index 8bfaa68..325cb8d 100644
--- a/mssql/template/makefile
+++ b/mssql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --default-database \
@@ -63,12 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mssql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mssql/types/makefile b/mssql/types/makefile
index 58636bd..8f86027 100644
--- a/mssql/types/makefile
+++ b/mssql/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --default-database \
@@ -65,12 +59,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mssql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -78,7 +67,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mysql/custom/makefile b/mysql/custom/makefile
index fa1dce3..f857ea4 100644
--- a/mysql/custom/makefile
+++ b/mysql/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --default-database \
@@ -66,12 +60,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -79,7 +68,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mysql/database/makefile b/mysql/database/makefile
index 63aa90d..d2426f6 100644
--- a/mysql/database/makefile
+++ b/mysql/database/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/mysql/index/makefile b/mysql/index/makefile
index a2ceec8..5c8838e 100644
--- a/mysql/index/makefile
+++ b/mysql/index/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --default-database \
@@ -63,12 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mysql/makefile b/mysql/makefile
index e657da7..02bb64f 100644
--- a/mysql/makefile
+++ b/mysql/makefile
@@ -13,11 +13,6 @@ native \
truncation \
types
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := mysql
diff --git a/mysql/native/makefile b/mysql/native/makefile
index 520c7ed..859c17a 100644
--- a/mysql/native/makefile
+++ b/mysql/native/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/mysql/template/makefile b/mysql/template/makefile
index e34f486..4109f3e 100644
--- a/mysql/template/makefile
+++ b/mysql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --default-database \
@@ -63,12 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mysql/truncation/makefile b/mysql/truncation/makefile
index 179c830..1a1f75b 100644
--- a/mysql/truncation/makefile
+++ b/mysql/truncation/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --default-database \
@@ -63,12 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/mysql/types/makefile b/mysql/types/makefile
index a1fa920..8cdc014 100644
--- a/mysql/types/makefile
+++ b/mysql/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --default-database \
@@ -65,12 +59,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/mysql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -78,7 +67,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/oracle/custom/makefile b/oracle/custom/makefile
index 7bae1fa..4022c16 100644
--- a/oracle/custom/makefile
+++ b/oracle/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --default-database \
@@ -66,12 +60,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/oracle.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -79,7 +68,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/oracle/database/makefile b/oracle/database/makefile
index 0eeb978..fe6bab6 100644
--- a/oracle/database/makefile
+++ b/oracle/database/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/oracle.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/oracle/makefile b/oracle/makefile
index 0033d89..918ec23 100644
--- a/oracle/makefile
+++ b/oracle/makefile
@@ -11,11 +11,6 @@ database \
native \
types
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := oracle
diff --git a/oracle/native/makefile b/oracle/native/makefile
index 9b7449e..5d799a8 100644
--- a/oracle/native/makefile
+++ b/oracle/native/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/oracle.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/oracle/template/makefile b/oracle/template/makefile
index 743b405..7433e36 100644
--- a/oracle/template/makefile
+++ b/oracle/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --default-database \
@@ -63,12 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/oracle.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/oracle/types/makefile b/oracle/types/makefile
index ebbfc19..5e7015f 100644
--- a/oracle/types/makefile
+++ b/oracle/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --default-database \
@@ -65,12 +59,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/oracle.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -78,7 +67,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/pgsql/custom/makefile b/pgsql/custom/makefile
index 5c98b1d..d675915 100644
--- a/pgsql/custom/makefile
+++ b/pgsql/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --default-database \
@@ -66,12 +60,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -79,7 +68,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/pgsql/database/makefile b/pgsql/database/makefile
index 490fd4e..398164d 100644
--- a/pgsql/database/makefile
+++ b/pgsql/database/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/pgsql/index/makefile b/pgsql/index/makefile
index e030f35..772802e 100644
--- a/pgsql/index/makefile
+++ b/pgsql/index/makefile
@@ -12,11 +12,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +24,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --default-database \
@@ -63,12 +55,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +63,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/pgsql/makefile b/pgsql/makefile
index 1111993..7dd15da 100644
--- a/pgsql/makefile
+++ b/pgsql/makefile
@@ -13,11 +13,6 @@ native \
truncation \
types
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := pgsql
diff --git a/pgsql/native/makefile b/pgsql/native/makefile
index a23b4a8..2c39100 100644
--- a/pgsql/native/makefile
+++ b/pgsql/native/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/pgsql/template/makefile b/pgsql/template/makefile
index 2f503a4..3d84b9b 100644
--- a/pgsql/template/makefile
+++ b/pgsql/template/makefile
@@ -12,11 +12,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +24,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --default-database \
@@ -63,12 +55,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +63,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/pgsql/truncation/makefile b/pgsql/truncation/makefile
index 099927e..416f2c2 100644
--- a/pgsql/truncation/makefile
+++ b/pgsql/truncation/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --default-database \
@@ -63,12 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -76,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/pgsql/types/makefile b/pgsql/types/makefile
index 7fe798c..94be6c0 100644
--- a/pgsql/types/makefile
+++ b/pgsql/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --default-database \
@@ -65,12 +59,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/pgsql.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -78,7 +67,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/common/basic/makefile b/qt/common/basic/makefile
index 05d3375..db50659 100644
--- a/qt/common/basic/makefile
+++ b/qt/common/basic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -81,12 +79,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -94,7 +91,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/common/containers/basics/makefile b/qt/common/containers/basics/makefile
index a14a29f..5f3b201 100644
--- a/qt/common/containers/basics/makefile
+++ b/qt/common/containers/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -81,12 +79,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -94,7 +91,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/common/containers/change-tracking/makefile b/qt/common/containers/change-tracking/makefile
index 4cfee92..582c8c4 100644
--- a/qt/common/containers/change-tracking/makefile
+++ b/qt/common/containers/change-tracking/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -81,12 +79,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -94,7 +91,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/common/makefile b/qt/common/makefile
index 1544fff..6b72fb0 100644
--- a/qt/common/makefile
+++ b/qt/common/makefile
@@ -14,11 +14,6 @@ template
all_tests := $(tests)
build_tests := $(tests)
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests)))
name := qt-common
@@ -40,6 +35,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests)))
$(call meta-vctest,$(name)-qt4-mysql-vc10.sln,test.bat)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(build_tests)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(tests))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_tests)))
$(call include,$(bld_root)/meta/vc9sln.make)
diff --git a/qt/common/smart-ptr/makefile b/qt/common/smart-ptr/makefile
index b539e08..7dad2e7 100644
--- a/qt/common/smart-ptr/makefile
+++ b/qt/common/smart-ptr/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -DQWEAKPOINTER_
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -81,12 +79,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -94,7 +91,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/common/template/makefile b/qt/common/template/makefile
index 9836dca..407094c 100644
--- a/qt/common/template/makefile
+++ b/qt/common/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -49,7 +43,11 @@ $(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -81,12 +79,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -94,7 +91,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/makefile b/qt/makefile
index 6050ec1..ea1e772 100644
--- a/qt/makefile
+++ b/qt/makefile
@@ -6,12 +6,12 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
all_dirs := common mysql sqlite pgsql oracle mssql
dirs := common
-dirs += $(db_id)
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
+# Database-specific tests are not run in the multi-database configuration.
+#
+ifneq ($(db_id),common)
+dirs += $(db_id)
+endif
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs)))
@@ -21,6 +21,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_dirs)))
$(call meta-automake)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(dirs)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(dirs))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_dirs)))
$(call include,$(bld_root)/dist.make)
diff --git a/qt/mssql/basic/makefile b/qt/mssql/basic/makefile
index 43fa876..4da6e63 100644
--- a/qt/mssql/basic/makefile
+++ b/qt/mssql/basic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --profile qt/basic \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/mssql/date-time/makefile b/qt/mssql/date-time/makefile
index f2ded55..4354696 100644
--- a/qt/mssql/date-time/makefile
+++ b/qt/mssql/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --profile qt/date-time \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/mssql/makefile b/qt/mssql/makefile
index 5f8f9a9..e3dc361 100644
--- a/qt/mssql/makefile
+++ b/qt/mssql/makefile
@@ -9,11 +9,6 @@ basic \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := qt-mssql
diff --git a/qt/mssql/template/makefile b/qt/mssql/template/makefile
index 33ebd1e..b126962 100644
--- a/qt/mssql/template/makefile
+++ b/qt/mssql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(driver): $(cxx_obj) $(odb_qt.l) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mssql --profile qt \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/mysql/basic/makefile b/qt/mysql/basic/makefile
index 8b174a5..f0e8814 100644
--- a/qt/mysql/basic/makefile
+++ b/qt/mysql/basic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --profile qt/basic \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/mysql/date-time/makefile b/qt/mysql/date-time/makefile
index 448cdcd..039b952 100644
--- a/qt/mysql/date-time/makefile
+++ b/qt/mysql/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --profile qt/date-time \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/mysql/makefile b/qt/mysql/makefile
index 97ac45d..e94b718 100644
--- a/qt/mysql/makefile
+++ b/qt/mysql/makefile
@@ -9,11 +9,6 @@ basic \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := qt-mysql
diff --git a/qt/mysql/template/makefile b/qt/mysql/template/makefile
index 91c5afe..9870235 100644
--- a/qt/mysql/template/makefile
+++ b/qt/mysql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(driver): $(cxx_obj) $(odb_qt.l) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database mysql --profile qt \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/oracle/basic/makefile b/qt/oracle/basic/makefile
index 046bc90..2069a29 100644
--- a/qt/oracle/basic/makefile
+++ b/qt/oracle/basic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --profile qt/basic \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/oracle/date-time/makefile b/qt/oracle/date-time/makefile
index 2dc6c38..b2f25ac 100644
--- a/qt/oracle/date-time/makefile
+++ b/qt/oracle/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --profile qt/date-time \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/oracle/makefile b/qt/oracle/makefile
index 8ae7df9..138e91c 100644
--- a/qt/oracle/makefile
+++ b/qt/oracle/makefile
@@ -9,11 +9,6 @@ basic \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := qt-oracle
diff --git a/qt/oracle/template/makefile b/qt/oracle/template/makefile
index 9b2863d..cc055cc 100644
--- a/qt/oracle/template/makefile
+++ b/qt/oracle/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(driver): $(cxx_obj) $(odb_qt.l) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database oracle --profile qt \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/pgsql/basic/makefile b/qt/pgsql/basic/makefile
index eaa4fdd..9dea1b1 100644
--- a/qt/pgsql/basic/makefile
+++ b/qt/pgsql/basic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --profile qt/basic \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/pgsql/date-time/makefile b/qt/pgsql/date-time/makefile
index 8c75ef3..46bccbb 100644
--- a/qt/pgsql/date-time/makefile
+++ b/qt/pgsql/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --profile qt/date-time \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/pgsql/makefile b/qt/pgsql/makefile
index fb89608..70df91b 100644
--- a/qt/pgsql/makefile
+++ b/qt/pgsql/makefile
@@ -9,11 +9,6 @@ basic \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := qt-pgsql
diff --git a/qt/pgsql/template/makefile b/qt/pgsql/template/makefile
index 8ffa434..9a1e72f 100644
--- a/qt/pgsql/template/makefile
+++ b/qt/pgsql/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(driver): $(cxx_obj) $(odb_qt.l) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database pgsql --profile qt \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/sqlite/basic/makefile b/qt/sqlite/basic/makefile
index 1689df6..2bac21a 100644
--- a/qt/sqlite/basic/makefile
+++ b/qt/sqlite/basic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --profile qt/basic \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/sqlite/date-time/makefile b/qt/sqlite/date-time/makefile
index a5f21ea..1af2338 100644
--- a/qt/sqlite/date-time/makefile
+++ b/qt/sqlite/date-time/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -38,9 +35,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
$(qt_core.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --profile qt/date-time \
@@ -79,12 +73,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -92,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/qt/sqlite/makefile b/qt/sqlite/makefile
index ccf700a..0ee2bf4 100644
--- a/qt/sqlite/makefile
+++ b/qt/sqlite/makefile
@@ -9,11 +9,6 @@ basic \
date-time \
template
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := qt-sqlite
diff --git a/qt/sqlite/template/makefile b/qt/sqlite/template/makefile
index ee53224..c0b8274 100644
--- a/qt/sqlite/template/makefile
+++ b/qt/sqlite/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(driver): $(cxx_obj) $(odb_qt.l) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --profile qt \
@@ -73,12 +67,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -86,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/sqlite/custom/makefile b/sqlite/custom/makefile
index 62d5539..f7a1cdb 100644
--- a/sqlite/custom/makefile
+++ b/sqlite/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --default-database \
@@ -63,11 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/sqlite.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -75,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/sqlite/database/makefile b/sqlite/database/makefile
index b2ec5cd..a96f6a7 100644
--- a/sqlite/database/makefile
+++ b/sqlite/database/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/sqlite.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/sqlite/makefile b/sqlite/makefile
index 1d87470..0fa93d8 100644
--- a/sqlite/makefile
+++ b/sqlite/makefile
@@ -12,11 +12,6 @@ native \
truncation \
types
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
$(dist): name := sqlite
diff --git a/sqlite/native/makefile b/sqlite/native/makefile
index 0d6a314..fe2404f 100644
--- a/sqlite/native/makefile
+++ b/sqlite/native/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -45,11 +40,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/sqlite.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
diff --git a/sqlite/template/makefile b/sqlite/template/makefile
index c4bb3f0..46a33e5 100644
--- a/sqlite/template/makefile
+++ b/sqlite/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --default-database \
@@ -63,11 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/sqlite.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -75,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/sqlite/truncation/makefile b/sqlite/truncation/makefile
index 6cfed59..4af9fef 100644
--- a/sqlite/truncation/makefile
+++ b/sqlite/truncation/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --default-database \
@@ -63,11 +57,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/sqlite.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -75,7 +65,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/sqlite/types/makefile b/sqlite/types/makefile
index cc6f7ff..3c7ae9b 100644
--- a/sqlite/types/makefile
+++ b/sqlite/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database sqlite --default-database \
@@ -65,11 +59,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/sqlite.options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -77,7 +67,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.