aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-21 16:55:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-21 16:55:21 +0200
commit9106867c0c70bae196c1b38e9594f0340dcc9698 (patch)
tree3f03d6b1b792c06e8a5674cc715190ca3e91baa9
parentf654efe02445c92661a20feffa9b2a9f40c996f5 (diff)
Factor out database macro setup
-rw-r--r--boost/makefile6
-rw-r--r--build/configuration.make11
-rw-r--r--composite/makefile6
-rw-r--r--container/makefile6
-rw-r--r--hello/makefile6
-rw-r--r--inverse/makefile6
-rw-r--r--mapping/makefile6
-rw-r--r--query/makefile6
-rw-r--r--relationship/makefile6
-rw-r--r--schema/custom/makefile6
-rw-r--r--schema/embedded/makefile6
-rw-r--r--template/makefile6
12 files changed, 21 insertions, 56 deletions
diff --git a/boost/makefile b/boost/makefile
index 9b66f68..5ef7eac 100644
--- a/boost/makefile
+++ b/boost/makefile
@@ -50,14 +50,10 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb_boost.l) $(odb.l) $(boost_date_time.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_boost.l.cpp-options) \
$(odb_db.l.cpp-options) $(boost.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/build/configuration.make b/build/configuration.make
index 2cf8c9a..768beb2 100644
--- a/build/configuration.make
+++ b/build/configuration.make
@@ -13,7 +13,16 @@ $(call -include,$(dcf_root)/configuration-dynamic.make)
ifdef db_id
-$(out_root)/%: db_id := $(db_id)
+ifeq ($(db_id),mysql)
+db_macro := DATABASE_MYSQL
+endif
+
+ifeq ($(db_id),sqlite)
+db_macro := DATABASE_SQLITE
+endif
+
+$(out_root)/%: db_id := $(db_id)
+$(out_root)/%: db_macro := $(db_macro)
else
diff --git a/composite/makefile b/composite/makefile
index 5881af0..185f1f9 100644
--- a/composite/makefile
+++ b/composite/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/container/makefile b/container/makefile
index 0d9dc80..800a68d 100644
--- a/container/makefile
+++ b/container/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/hello/makefile b/hello/makefile
index a88232e..e1a2471 100644
--- a/hello/makefile
+++ b/hello/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/inverse/makefile b/inverse/makefile
index 7ac0219..1b56e64 100644
--- a/inverse/makefile
+++ b/inverse/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/mapping/makefile b/mapping/makefile
index 1a83a39..273e0ab 100644
--- a/mapping/makefile
+++ b/mapping/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/query/makefile b/query/makefile
index 6c9193b..a332378 100644
--- a/query/makefile
+++ b/query/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/relationship/makefile b/relationship/makefile
index 34d7a91..e8d3d1a 100644
--- a/relationship/makefile
+++ b/relationship/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/schema/custom/makefile b/schema/custom/makefile
index 23f3de2..1e36d55 100644
--- a/schema/custom/makefile
+++ b/schema/custom/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/schema/embedded/makefile b/schema/embedded/makefile
index c54d509..46f1e3c 100644
--- a/schema/embedded/makefile
+++ b/schema/embedded/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/template/makefile b/template/makefile
index 4f1542c..2675389 100644
--- a/template/makefile
+++ b/template/makefile
@@ -38,13 +38,9 @@ endif
# Build.
#
$(driver): $(cxx_obj) $(odb_db.l) $(odb.l)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -D$(db_macro)
$(cxx_obj) $(cxx_od): $(odb.l.cpp-options) $(odb_db.l.cpp-options)
-ifeq ($(db_id),mysql)
-$(cxx_obj) $(cxx_od): cpp_options += -DDATABASE_MYSQL
-endif
-
genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
gen := $(addprefix $(out_base)/,$(genf))