From 6cd8b9f561b912f264ba4f723845935c40a3cb95 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Fri, 21 Jun 2013 10:39:59 +0200
Subject: Add support for running tests in dynamic multi-database mode

Only possible in the development build system at this stage.
---
 boost/mysql/date-time/makefile | 21 +++++----------------
 boost/mysql/makefile           |  5 -----
 boost/mysql/template/makefile  | 21 +++++----------------
 3 files changed, 10 insertions(+), 37 deletions(-)

(limited to 'boost/mysql')

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.
-- 
cgit v1.1