aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Makefile.am10
-rw-r--r--common/auto/makefile14
-rw-r--r--common/lifecycle/makefile14
-rw-r--r--common/makefile26
-rw-r--r--common/query/makefile17
-rw-r--r--common/schema/makefile14
-rw-r--r--common/template/Makefile.am24
-rw-r--r--common/template/makefile14
-rw-r--r--common/threads/makefile15
9 files changed, 136 insertions, 12 deletions
diff --git a/common/Makefile.am b/common/Makefile.am
new file mode 100644
index 0000000..a526e4c
--- /dev/null
+++ b/common/Makefile.am
@@ -0,0 +1,10 @@
+# file : common/Makefile.am
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+SUBDIRS = __path__(dirs)
+
+if ODB_TESTS_THREADS
+SUBDIRS += __path__(thread_dirs)
+endif
diff --git a/common/auto/makefile b/common/auto/makefile
index 31c7efb..b39759a 100644
--- a/common/auto/makefile
+++ b/common/auto/makefile
@@ -14,6 +14,7 @@ common.l := $(out_root)/libcommon/common.l
common.l.cpp-options := $(out_root)/libcommon/common.l.cpp-options
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -34,7 +35,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database $(db_id) --generate-schema
+$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema
$(gen): cpp_options := -I$(out_base)
$(gen): $(common.l.cpp-options)
@@ -44,6 +45,14 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist): db_id := @database@
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/common/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -72,6 +81,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(odb_rules))
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
diff --git a/common/lifecycle/makefile b/common/lifecycle/makefile
index 21278fc..73cc2e4 100644
--- a/common/lifecycle/makefile
+++ b/common/lifecycle/makefile
@@ -14,6 +14,7 @@ common.l := $(out_root)/libcommon/common.l
common.l.cpp-options := $(out_root)/libcommon/common.l.cpp-options
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -34,7 +35,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database $(db_id) --generate-schema
+$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema
$(gen): cpp_options := -I$(out_base)
$(gen): $(common.l.cpp-options)
@@ -44,6 +45,14 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist): db_id := @database@
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/common/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -72,6 +81,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(odb_rules))
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
diff --git a/common/makefile b/common/makefile
index 1e56ecb..ef085e9 100644
--- a/common/makefile
+++ b/common/makefile
@@ -12,14 +12,30 @@ template \
lifecycle \
query
-tests += threads
+thread_tests := threads
+
+all_tests := $(tests) $(thread_tests)
+build_tests := $(tests) $(thread_tests)
default := $(out_base)/
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
-$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
-$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests)))
-$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests)))
+$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests)))
+
+$(dist): export dirs := $(tests)
+$(dist): export thread_dirs := $(thread_tests)
+$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests)))
+ $(call meta-automake)
+
+$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(build_tests)))
+$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_tests)))
+
+$(call include,$(bld_root)/dist.make)
-$(foreach t,$(tests),$(call import,$(src_base)/$t/makefile))
+ifneq ($(filter $(MAKECMDGOALS),dist clean),)
+$(foreach t,$(all_tests),$(call import,$(src_base)/$t/makefile))
+else
+$(foreach t,$(build_tests),$(call import,$(src_base)/$t/makefile))
+endif
diff --git a/common/query/makefile b/common/query/makefile
index 5389d55..27e19e8 100644
--- a/common/query/makefile
+++ b/common/query/makefile
@@ -14,6 +14,7 @@ common.l := $(out_root)/libcommon/common.l
common.l.cpp-options := $(out_root)/libcommon/common.l.cpp-options
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -34,8 +35,8 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database $(db_id) --generate-schema \
---generate-query --hxx-prologue '\\\#include "traits.hxx"'
+$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \
+--generate-query --hxx-prologue '\#include "traits.hxx"'
$(gen): cpp_options := -I$(out_base)
$(gen): $(common.l.cpp-options)
@@ -45,6 +46,15 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) traits.hxx test.std
+$(dist): export extra_headers := traits.hxx
+$(dist): db_id := @database@
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/common/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -73,6 +83,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(odb_rules))
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
diff --git a/common/schema/makefile b/common/schema/makefile
index 29cca5f..de22c01 100644
--- a/common/schema/makefile
+++ b/common/schema/makefile
@@ -14,6 +14,7 @@ common.l := $(out_root)/libcommon/common.l
common.l.cpp-options := $(out_root)/libcommon/common.l.cpp-options
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -34,7 +35,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database $(db_id) --generate-schema
+$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema
$(gen): cpp_options := -I$(out_base)
$(gen): $(common.l.cpp-options)
@@ -44,6 +45,14 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist): db_id := @database@
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/common/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -72,6 +81,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(odb_rules))
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
diff --git a/common/template/Makefile.am b/common/template/Makefile.am
new file mode 100644
index 0000000..b2fc122
--- /dev/null
+++ b/common/template/Makefile.am
@@ -0,0 +1,24 @@
+# file : common/template/Makefile.am
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+noinst_PROGRAMS = driver
+driver_SOURCES = driver.cxx __path__(extra_sources) __path__(extra_headers)
+driver_LDADD = $(top_builddir)/libcommon/libcommon.la
+driver_CPPFLAGS = -I'$(top_builddir)/libcommon' -I'$(top_srcdir)/libcommon'
+
+TESTS=$(top_builddir)/tester
+TESTS_ENVIRONMENT=top_builddir=$(top_builddir);
+
+# ODB compilation.
+#
+driver_SOURCES += test.hxx test-odb.cxx
+BUILT_SOURCES = test-odb.hxx
+CLEANFILES = test-odb.hxx test-odb.ixx test-odb.cxx
+
+ODB = @ODB@
+ODBFLAGS = @ODBFLAGS@
+
+test-odb.hxx: test.hxx
+ $(ODB) $(ODBCPPFLAGS) $(CPPFLAGS) $(ODBFLAGS) __value__(odb_options) $<
diff --git a/common/template/makefile b/common/template/makefile
index c963659..cdc8f91 100644
--- a/common/template/makefile
+++ b/common/template/makefile
@@ -14,6 +14,7 @@ common.l := $(out_root)/libcommon/common.l
common.l.cpp-options := $(out_root)/libcommon/common.l.cpp-options
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -34,7 +35,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database $(db_id) --generate-schema
+$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema
$(gen): cpp_options := -I$(out_base)
$(gen): $(common.l.cpp-options)
@@ -44,6 +45,14 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist): db_id := @database@
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -72,6 +81,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(odb_rules))
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
diff --git a/common/threads/makefile b/common/threads/makefile
index af03a93..6a8c802 100644
--- a/common/threads/makefile
+++ b/common/threads/makefile
@@ -14,6 +14,7 @@ common.l := $(out_root)/libcommon/common.l
common.l.cpp-options := $(out_root)/libcommon/common.l.cpp-options
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -34,7 +35,8 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database $(db_id) --generate-schema --generate-query
+$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \
+--generate-query
$(gen): cpp_options := -I$(out_base)
$(gen): $(common.l.cpp-options)
@@ -44,6 +46,14 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist): db_id := @database@
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/common/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -72,6 +82,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(odb_rules))
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)