aboutsummaryrefslogtreecommitdiff
path: root/tracer
diff options
context:
space:
mode:
Diffstat (limited to 'tracer')
-rw-r--r--tracer/Makefile.am6
-rw-r--r--tracer/makefile9
-rw-r--r--tracer/object/makefile13
-rw-r--r--tracer/template/Makefile.am25
-rw-r--r--tracer/template/driver.cxx35
-rw-r--r--tracer/template/makefile92
-rw-r--r--tracer/template/test.hxx27
-rw-r--r--tracer/template/test.std3
-rw-r--r--tracer/transaction/makefile11
-rw-r--r--tracer/types/makefile13
10 files changed, 232 insertions, 2 deletions
diff --git a/tracer/Makefile.am b/tracer/Makefile.am
new file mode 100644
index 0000000..32feb34
--- /dev/null
+++ b/tracer/Makefile.am
@@ -0,0 +1,6 @@
+# file : tracer/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)
diff --git a/tracer/makefile b/tracer/makefile
index 03b8747..731573a 100644
--- a/tracer/makefile
+++ b/tracer/makefile
@@ -6,16 +6,25 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
tests := \
+template \
object \
transaction \
types
default := $(out_base)/
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests)))
+
+$(dist): export dirs := $(tests)
+$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(tests)))
+ $(call meta-automake)
+
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests)))
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests)))
+$(call include,$(bld_root)/meta/automake.make)
+
$(foreach t,$(tests),$(call import,$(src_base)/$t/makefile))
diff --git a/tracer/object/makefile b/tracer/object/makefile
index ed7c562..1fd819b 100644
--- a/tracer/object/makefile
+++ b/tracer/object/makefile
@@ -11,6 +11,7 @@ cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
cxx_od := $(cxx_obj:.o=.o.d)
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -39,7 +40,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database tracer
+$(gen) $(dist): export odb_options += --database tracer
$(gen): cpp_options := -I$(out_base)
$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
@@ -49,6 +50,13 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/tracer/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -75,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/tracer/template/Makefile.am b/tracer/template/Makefile.am
new file mode 100644
index 0000000..09e4f09
--- /dev/null
+++ b/tracer/template/Makefile.am
@@ -0,0 +1,25 @@
+# file : tracer/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)
+
+TESTS=$(top_builddir)/tester
+TESTS_ENVIRONMENT=top_builddir=$(top_builddir);
+
+m4_ifelse(__value__(odb_options),,,
+
+# 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/tracer/template/driver.cxx b/tracer/template/driver.cxx
new file mode 100644
index 0000000..c727fac
--- /dev/null
+++ b/tracer/template/driver.cxx
@@ -0,0 +1,35 @@
+// file : tracer/template/driver.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// PLACE TEST DESCRIPTION HERE
+//
+
+#include <memory>
+#include <cassert>
+#include <iostream>
+
+#include <odb/exceptions.hxx>
+#include <odb/transaction.hxx>
+#include <odb/tracer/database.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb;
+
+int
+main ()
+{
+ tracer::database db;
+
+ //
+ //
+ cout << "test 001" << endl;
+ {
+ transaction t (db.begin_transaction ());
+ t.commit ();
+ }
+}
diff --git a/tracer/template/makefile b/tracer/template/makefile
new file mode 100644
index 0000000..b7b82b7
--- /dev/null
+++ b/tracer/template/makefile
@@ -0,0 +1,92 @@
+# file : tracer/template/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+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))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+driver := $(out_base)/driver
+dist := $(out_base)/.dist
+test := $(out_base)/.test
+clean := $(out_base)/.clean
+
+# Import.
+#
+$(call import,\
+ $(scf_root)/import/odb/stub.make,\
+ odb: odb,odb-rules: odb_rules)
+
+$(call import,\
+ $(scf_root)/import/libodb/stub.make,\
+ l: odb.l,cpp-options: odb.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libodb-tracer/stub.make,\
+ l: odb_tracer.l,cpp-options: odb_tracer.l.cpp-options)
+
+# Build.
+#
+$(driver): $(cxx_obj) $(odb_tracer.l) $(odb.l)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
+$(cxx_obj) $(cxx_od): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
+
+genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx)
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(odb)
+$(gen): odb := $(odb)
+$(gen) $(dist): export odb_options += --database tracer
+$(gen): cpp_options := -I$(out_base)
+$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
+
+$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
+
+# Alias for default target.
+#
+$(out_base)/: $(driver)
+
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake)
+
+# Test.
+#
+$(test): $(driver) $(src_base)/test.std
+ $(call message,test $<,$< | diff -u $(src_base)/test.std -)
+
+# Clean.
+#
+$(clean): \
+ $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(driver): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := driver $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+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)
+$(call include,$(bld_root)/cxx/o-e.make)
diff --git a/tracer/template/test.hxx b/tracer/template/test.hxx
new file mode 100644
index 0000000..06d7155
--- /dev/null
+++ b/tracer/template/test.hxx
@@ -0,0 +1,27 @@
+// file : tracer/template/test.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma odb object
+struct object
+{
+ object (unsigned long id)
+ : id_ (id)
+ {
+ }
+
+ object ()
+ {
+ }
+
+ #pragma odb id
+ unsigned long id_;
+};
+
+#endif // TEST_HXX
diff --git a/tracer/template/test.std b/tracer/template/test.std
new file mode 100644
index 0000000..ac654fc
--- /dev/null
+++ b/tracer/template/test.std
@@ -0,0 +1,3 @@
+test 001
+begin transaction
+commit transaction
diff --git a/tracer/transaction/makefile b/tracer/transaction/makefile
index 5919e6e..fd1d698 100644
--- a/tracer/transaction/makefile
+++ b/tracer/transaction/makefile
@@ -10,6 +10,7 @@ cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -35,6 +36,13 @@ $(call include-dep,$(cxx_od))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) test.std
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/tracer/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -60,6 +68,9 @@ endif
# How to.
#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/automake.make)
+
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
$(call include,$(bld_root)/cxx/o-e.make)
diff --git a/tracer/types/makefile b/tracer/types/makefile
index 382d1b5..f042476 100644
--- a/tracer/types/makefile
+++ b/tracer/types/makefile
@@ -11,6 +11,7 @@ cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
cxx_od := $(cxx_obj:.o=.o.d)
driver := $(out_base)/driver
+dist := $(out_base)/.dist
test := $(out_base)/.test
clean := $(out_base)/.clean
@@ -39,7 +40,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen): odb_options += --database tracer
+$(gen) $(dist): export odb_options += --database tracer
$(gen): cpp_options := -I$(out_base)
$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
@@ -49,6 +50,13 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
#
$(out_base)/: $(driver)
+# Dist
+#
+$(dist): data_dist := $(cxx_tun) $(odb_hdr) test.std
+$(dist):
+ $(call dist-data,$(data_dist))
+ $(call meta-automake,$(src_root)/tracer/template/Makefile.am)
+
# Test.
#
$(test): $(driver) $(src_base)/test.std
@@ -75,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)