aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-02-05 18:01:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-02-05 18:01:45 +0200
commitd7b7e218bfe92516f525568a6c1c9e1a9eb241fe (patch)
tree6cbc3155d7188f65e4b806c6edeecdd53393da69 /examples
Start tracking build with git
Diffstat (limited to 'examples')
-rw-r--r--examples/cxx/hello/hello/build/bootstrap.make8
l---------examples/cxx/hello/hello/build/import/libhello1
-rw-r--r--examples/cxx/hello/hello/hello.cxx8
-rw-r--r--examples/cxx/hello/hello/makefile71
-rw-r--r--examples/cxx/hello/libhello/build/bootstrap.make8
-rw-r--r--examples/cxx/hello/libhello/build/export/libhello/stub.make10
-rw-r--r--examples/cxx/hello/libhello/build/import/libhello/configuration-rules.make15
-rwxr-xr-xexamples/cxx/hello/libhello/build/import/libhello/configure54
-rw-r--r--examples/cxx/hello/libhello/build/import/libhello/stub.make30
-rw-r--r--examples/cxx/hello/libhello/libhello/hello.cxx9
-rw-r--r--examples/cxx/hello/libhello/libhello/hello.hxx6
-rw-r--r--examples/cxx/hello/libhello/libhello/makefile65
-rw-r--r--examples/cxx/hello/libhello/makefile39
-rw-r--r--examples/cxx/hello/libhello/test/driver.cxx8
-rw-r--r--examples/cxx/hello/libhello/test/makefile67
-rw-r--r--examples/cxx/multidir/bar/bar.cxx4
-rw-r--r--examples/cxx/multidir/build/bootstrap.make8
-rw-r--r--examples/cxx/multidir/driver.cxx4
-rw-r--r--examples/cxx/multidir/foo/foo.cxx4
-rw-r--r--examples/cxx/multidir/makefile47
-rw-r--r--examples/m4/libhello/build/bootstrap.make8
-rw-r--r--examples/m4/libhello/hello/hello.cxx9
-rw-r--r--examples/m4/libhello/hello/hello.hxx.m410
-rw-r--r--examples/m4/libhello/hello/makefile71
-rw-r--r--examples/m4/libhello/makefile39
-rw-r--r--examples/m4/libhello/test/driver.cxx10
-rw-r--r--examples/m4/libhello/test/driver.hxx.m45
-rw-r--r--examples/m4/libhello/test/makefile70
28 files changed, 688 insertions, 0 deletions
diff --git a/examples/cxx/hello/hello/build/bootstrap.make b/examples/cxx/hello/hello/build/bootstrap.make
new file mode 100644
index 0000000..ad397b9
--- /dev/null
+++ b/examples/cxx/hello/hello/build/bootstrap.make
@@ -0,0 +1,8 @@
+# file : examples/cxx/hello/hello/build/bootstrap.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project_name := hello driver
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
diff --git a/examples/cxx/hello/hello/build/import/libhello b/examples/cxx/hello/hello/build/import/libhello
new file mode 120000
index 0000000..1943500
--- /dev/null
+++ b/examples/cxx/hello/hello/build/import/libhello
@@ -0,0 +1 @@
+../../../libhello/build/import/libhello \ No newline at end of file
diff --git a/examples/cxx/hello/hello/hello.cxx b/examples/cxx/hello/hello/hello.cxx
new file mode 100644
index 0000000..1ec9d31
--- /dev/null
+++ b/examples/cxx/hello/hello/hello.cxx
@@ -0,0 +1,8 @@
+#include "libhello/hello.hxx"
+
+int
+main ()
+{
+ hello h;
+ h.say ("Hello, world!");
+}
diff --git a/examples/cxx/hello/hello/makefile b/examples/cxx/hello/hello/makefile
new file mode 100644
index 0000000..3fc4826
--- /dev/null
+++ b/examples/cxx/hello/hello/makefile
@@ -0,0 +1,71 @@
+# file : examples/cxx/hello/hello/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make
+
+cxx_tun := hello.cxx
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+hello := $(out_base)/hello
+clean := $(out_base)/.clean
+install := $(out_base)/.install
+
+
+# Secure default target.
+#
+#$(hello):
+
+
+# Import information about libhello.
+#
+$(call import,\
+ $(scf_root)/import/libhello/stub.make,\
+ l: hello.l,cpp-options: hello.l.cpp-options)
+
+
+# Build.
+#
+$(hello): $(cxx_obj) $(hello.l)
+
+$(cxx_obj) $(cxx_od): $(hello.l.cpp-options)
+
+$(call -include,$(cxx_od))
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(hello).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od))
+
+
+# Install.
+#
+.PHONY: $(install)
+
+$(install): $(hello)
+ $(call install-exec,$<,$(install_bin_dir)/hello)
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: clean install
+
+clean: $(clean)
+install: $(install)
+
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/install.make)
diff --git a/examples/cxx/hello/libhello/build/bootstrap.make b/examples/cxx/hello/libhello/build/bootstrap.make
new file mode 100644
index 0000000..400439c
--- /dev/null
+++ b/examples/cxx/hello/libhello/build/bootstrap.make
@@ -0,0 +1,8 @@
+# file : examples/cxx/hello/libhello/build/bootstrap.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project_name := libhello
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
diff --git a/examples/cxx/hello/libhello/build/export/libhello/stub.make b/examples/cxx/hello/libhello/build/export/libhello/stub.make
new file mode 100644
index 0000000..1184136
--- /dev/null
+++ b/examples/cxx/hello/libhello/build/export/libhello/stub.make
@@ -0,0 +1,10 @@
+# file : examples/cxx/hello/libhello/build/export/libhello/stub.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include-once,$(src_root)/libhello/makefile)
+
+$(call export,\
+ l: $(out_root)/libhello/hello.l,\
+ cpp-options: $(out_root)/libhello/hello.l.cpp-options)
diff --git a/examples/cxx/hello/libhello/build/import/libhello/configuration-rules.make b/examples/cxx/hello/libhello/build/import/libhello/configuration-rules.make
new file mode 100644
index 0000000..df8dfda
--- /dev/null
+++ b/examples/cxx/hello/libhello/build/import/libhello/configuration-rules.make
@@ -0,0 +1,15 @@
+# file : examples/cxx/hello/libhello/build/import/libhello/configuration-rules.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(dcf_root)/import/libhello/configuration-dynamic.make: | $(dcf_root)/import/libhello/.
+ $(call message,,$(scf_root)/import/libhello/configure $@)
+
+ifndef %foreign%
+
+disfigure::
+ $(call message,rm $(dcf_root)/import/libhello/configuration-dynamic.make,\
+rm -f $(dcf_root)/import/libhello/configuration-dynamic.make)
+
+endif
diff --git a/examples/cxx/hello/libhello/build/import/libhello/configure b/examples/cxx/hello/libhello/build/import/libhello/configure
new file mode 100755
index 0000000..055c17e
--- /dev/null
+++ b/examples/cxx/hello/libhello/build/import/libhello/configure
@@ -0,0 +1,54 @@
+#! /usr/bin/env bash
+
+# file : examples/cxx/hello/libhello/build/import/libhello/configure
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+
+# $1 - out file
+#
+# bld_root - build root
+# project_name - project name
+#
+
+source $bld_root/dialog.bash
+
+$echo
+$echo "Configuring external dependency on 'libhello' for '$project_name'."
+$echo
+
+$echo
+$echo "Would you like to configure dependency on the installed"
+$echo "version of 'libhello' as opposed to the development build?"
+$echo
+
+installed=`read_y_n y`
+
+
+if [ "$installed" = "n" ]; then
+
+
+$echo
+$echo "Please enter the src_root for 'libhello'."
+$echo
+
+src_root=`read_path --directory --exist`
+
+$echo
+$echo "Please enter the out_root for 'libhello'."
+$echo
+
+out_root=`read_path --directory $src_root`
+
+fi
+
+echo libhello_installed := $installed >$1
+
+if [ "$installed" == "n" ]; then
+
+echo src_root := $src_root >>$1
+echo scf_root := \$\(src_root\)/build >>$1
+echo out_root := $out_root >>$1
+
+fi
diff --git a/examples/cxx/hello/libhello/build/import/libhello/stub.make b/examples/cxx/hello/libhello/build/import/libhello/stub.make
new file mode 100644
index 0000000..9966a54
--- /dev/null
+++ b/examples/cxx/hello/libhello/build/import/libhello/stub.make
@@ -0,0 +1,30 @@
+# file : examples/cxx/hello/libhello/build/import/libhello/stub.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include-once,$(scf_root)/import/libhello/configuration-rules.make,$(dcf_root))
+
+libhello_installed :=
+
+$(call -include,$(dcf_root)/import/libhello/configuration-dynamic.make)
+
+ifdef libhello_installed
+
+ifeq ($(libhello_installed),y)
+
+$(call export,l: -lhello,cpp-options:)
+
+else
+
+# Include export stub.
+#
+$(call include,$(scf_root)/export/libhello/stub.make)
+
+endif
+
+else
+
+.NOTPARALLEL:
+
+endif
diff --git a/examples/cxx/hello/libhello/libhello/hello.cxx b/examples/cxx/hello/libhello/libhello/hello.cxx
new file mode 100644
index 0000000..4c2f721
--- /dev/null
+++ b/examples/cxx/hello/libhello/libhello/hello.cxx
@@ -0,0 +1,9 @@
+#include "libhello/hello.hxx"
+
+#include <iostream>
+
+void hello::
+say (char const* phrase)
+{
+ std::cerr << phrase << std::endl;
+}
diff --git a/examples/cxx/hello/libhello/libhello/hello.hxx b/examples/cxx/hello/libhello/libhello/hello.hxx
new file mode 100644
index 0000000..ecb9e84
--- /dev/null
+++ b/examples/cxx/hello/libhello/libhello/hello.hxx
@@ -0,0 +1,6 @@
+class hello
+{
+public:
+ void
+ say (char const* phrase);
+};
diff --git a/examples/cxx/hello/libhello/libhello/makefile b/examples/cxx/hello/libhello/libhello/makefile
new file mode 100644
index 0000000..3b5752a
--- /dev/null
+++ b/examples/cxx/hello/libhello/libhello/makefile
@@ -0,0 +1,65 @@
+# file : examples/cxx/hello/libhello/libhello/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
+
+cxx_tun := hello.cxx
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+hello.l := $(out_base)/hello.l
+hello.l.cpp-options := $(out_base)/hello.l.cpp-options
+
+install := $(out_base)/.install
+clean := $(out_base)/.clean
+
+
+# Build.
+#
+$(hello.l): $(cxx_obj)
+
+$(cxx_obj) $(cxx_od): $(hello.l.cpp-options)
+
+$(hello.l.cpp-options): value := -I$(src_root)
+
+$(call -include,$(cxx_od))
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(hello.l).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(hello.l.cpp-options).clean
+
+
+# Install.
+#
+.PHONY: $(install)
+
+$(install): $(hello.l)
+ $(call install-lib,$<,$(install_lib_dir)/$(ld_lib_prefix)hello$(ld_lib_suffix))
+ $(call install-dir,$(src_base),$(install_inc_dir)/libhello,-name '*.hxx')
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: clean install
+
+clean: $(clean)
+install: $(install)
+
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-l.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/install.make)
diff --git a/examples/cxx/hello/libhello/makefile b/examples/cxx/hello/libhello/makefile
new file mode 100644
index 0000000..ed5ceff
--- /dev/null
+++ b/examples/cxx/hello/libhello/makefile
@@ -0,0 +1,39 @@
+# file : examples/cxx/hello/libhello/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make
+
+default := $(out_base)/
+install := $(out_base)/.install
+clean := $(out_base)/.clean
+test := $(out_base)/.test
+
+.PHONY: $(default) $(install) $(test) $(clean)
+
+$(default): $(out_base)/libhello/hello.l $(out_base)/test/driver
+
+$(install): $(out_base)/libhello/.install
+
+$(clean): $(out_base)/libhello/.clean $(out_base)/test/.clean
+
+$(test): $(out_base)/test/.test
+
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: install test clean
+
+install: $(install)
+clean: $(clean)
+test: $(test)
+
+endif
+
+# Import build rules.
+#
+$(call import,$(src_base)/libhello/makefile)
+$(call import,$(src_base)/test/makefile)
diff --git a/examples/cxx/hello/libhello/test/driver.cxx b/examples/cxx/hello/libhello/test/driver.cxx
new file mode 100644
index 0000000..ff25abd
--- /dev/null
+++ b/examples/cxx/hello/libhello/test/driver.cxx
@@ -0,0 +1,8 @@
+#include "libhello/hello.hxx"
+
+int
+main ()
+{
+ hello h;
+ h.say ("Hey, hey, hey!");
+}
diff --git a/examples/cxx/hello/libhello/test/makefile b/examples/cxx/hello/libhello/test/makefile
new file mode 100644
index 0000000..d4fb4da
--- /dev/null
+++ b/examples/cxx/hello/libhello/test/makefile
@@ -0,0 +1,67 @@
+# file : examples/cxx/hello/libhello/test/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-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
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+hello.l := $(out_root)/libhello/hello.l
+hello.l.cpp-options := $(out_root)/libhello/hello.l.cpp-options
+
+driver := $(out_base)/driver
+clean := $(out_base)/.clean
+test := $(out_base)/.test
+
+
+# Build.
+#
+$(driver): $(cxx_obj) $(hello.l)
+
+$(cxx_obj) $(cxx_od): $(hello.l.cpp-options)
+
+$(call -include,$(cxx_od))
+
+
+# Test.
+#
+.PHONY: $(test)
+
+$(test): $(driver)
+ $<
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od))
+
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: clean test
+
+test: $(test)
+clean: $(clean)
+
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+
+
+# Import build rules.
+#
+$(call import,$(src_root)/libhello/makefile)
diff --git a/examples/cxx/multidir/bar/bar.cxx b/examples/cxx/multidir/bar/bar.cxx
new file mode 100644
index 0000000..31781e8
--- /dev/null
+++ b/examples/cxx/multidir/bar/bar.cxx
@@ -0,0 +1,4 @@
+void
+bar ()
+{
+}
diff --git a/examples/cxx/multidir/build/bootstrap.make b/examples/cxx/multidir/build/bootstrap.make
new file mode 100644
index 0000000..ac19a30
--- /dev/null
+++ b/examples/cxx/multidir/build/bootstrap.make
@@ -0,0 +1,8 @@
+# file : examples/cxx/multidir/build/bootstrap.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project_name := multidir
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
diff --git a/examples/cxx/multidir/driver.cxx b/examples/cxx/multidir/driver.cxx
new file mode 100644
index 0000000..70b4146
--- /dev/null
+++ b/examples/cxx/multidir/driver.cxx
@@ -0,0 +1,4 @@
+int
+main ()
+{
+}
diff --git a/examples/cxx/multidir/foo/foo.cxx b/examples/cxx/multidir/foo/foo.cxx
new file mode 100644
index 0000000..5b5ccbf
--- /dev/null
+++ b/examples/cxx/multidir/foo/foo.cxx
@@ -0,0 +1,4 @@
+void
+foo ()
+{
+}
diff --git a/examples/cxx/multidir/makefile b/examples/cxx/multidir/makefile
new file mode 100644
index 0000000..c368828
--- /dev/null
+++ b/examples/cxx/multidir/makefile
@@ -0,0 +1,47 @@
+# file : examples/cxx/multidir/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-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 foo/foo.cxx bar/bar.cxx
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+driver := $(out_base)/driver
+clean := $(out_base)/.clean
+
+
+# Build.
+#
+$(driver): $(cxx_obj)
+
+$(call -include,$(cxx_od))
+
+
+# Clean
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od))
+
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: clean
+
+clean: $(clean)
+
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
diff --git a/examples/m4/libhello/build/bootstrap.make b/examples/m4/libhello/build/bootstrap.make
new file mode 100644
index 0000000..7288d7b
--- /dev/null
+++ b/examples/m4/libhello/build/bootstrap.make
@@ -0,0 +1,8 @@
+# file : examples/m4/hello/libhello/build/bootstrap.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project_name := libhello
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
diff --git a/examples/m4/libhello/hello/hello.cxx b/examples/m4/libhello/hello/hello.cxx
new file mode 100644
index 0000000..049e9ce
--- /dev/null
+++ b/examples/m4/libhello/hello/hello.cxx
@@ -0,0 +1,9 @@
+#include <hello/hello.hxx>
+
+#include <iostream>
+
+void hello::
+say (char const* phrase)
+{
+ std::cerr << phrase << std::endl;
+}
diff --git a/examples/m4/libhello/hello/hello.hxx.m4 b/examples/m4/libhello/hello/hello.hxx.m4
new file mode 100644
index 0000000..1446096
--- /dev/null
+++ b/examples/m4/libhello/hello/hello.hxx.m4
@@ -0,0 +1,10 @@
+dnl
+dnl There aren't any macro expansions; it's just an example.
+dnl
+
+class hello
+{
+public:
+ void
+ say (char const* phrase);
+};
diff --git a/examples/m4/libhello/hello/makefile b/examples/m4/libhello/hello/makefile
new file mode 100644
index 0000000..26d98a9
--- /dev/null
+++ b/examples/m4/libhello/hello/makefile
@@ -0,0 +1,71 @@
+# file : examples/m4/hello/libhello/hello/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
+
+cxx_tun := hello.cxx
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+hello.l := $(out_base)/hello.l
+hello.l.cpp-options := $(out_base)/hello.l.cpp-options
+
+install := $(out_base)/.install
+clean := $(out_base)/.clean
+
+
+# Build.
+#
+$(hello.l): $(cxx_obj)
+
+$(cxx_obj) $(cxx_od): $(hello.l.cpp-options)
+
+#@@ not necessary
+#$(out_base)/hello.hxx: $(src_base)/hello.hxx.m4
+
+$(hello.l.cpp-options): prefix := hello/ $(out_root)/
+$(hello.l.cpp-options): value := -I$(src_root) -I$(out_root)
+
+$(call -include,$(cxx_od))
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(hello.l).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(out_base)/hello.hxx.m4.clean \
+ $(hello.l.cpp-options).clean
+
+
+# !! broken: need to install hello.hxx from out_root Install.
+#
+.PHONY: $(install)
+
+$(install): $(hello.l)
+ $(call install-lib,$<,$(install_lib_dir)/$(ld_lib_prefix)hello$(ld_lib_suffix))
+ $(call install-dir,$(src_base),$(install_inc_dir)/hello,-name '*.hxx')
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: clean install
+
+clean: $(clean)
+install: $(install)
+
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-l.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/m4/m4.make)
+$(call include,$(bld_root)/install.make)
diff --git a/examples/m4/libhello/makefile b/examples/m4/libhello/makefile
new file mode 100644
index 0000000..fcb5bb2
--- /dev/null
+++ b/examples/m4/libhello/makefile
@@ -0,0 +1,39 @@
+# file : examples/cxx/hello/libhello/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make
+
+default := $(out_base)/
+install := $(out_base)/.install
+clean := $(out_base)/.clean
+test := $(out_base)/.test
+
+.PHONY: $(default) $(install) $(test) $(clean)
+
+$(default): $(out_base)/hello/hello.l $(out_base)/test/driver
+
+$(install): $(out_base)/hello/.install
+
+$(clean): $(out_base)/hello/.clean $(out_base)/test/.clean
+
+$(test): $(out_base)/test/.test
+
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: install test clean
+
+install: $(install)
+clean: $(clean)
+test: $(test)
+
+endif
+
+# Import build rules.
+#
+$(call import,$(src_base)/hello/makefile)
+$(call import,$(src_base)/test/makefile)
diff --git a/examples/m4/libhello/test/driver.cxx b/examples/m4/libhello/test/driver.cxx
new file mode 100644
index 0000000..1809049
--- /dev/null
+++ b/examples/m4/libhello/test/driver.cxx
@@ -0,0 +1,10 @@
+#include <hello/hello.hxx>
+
+#include "driver.hxx"
+
+int
+main ()
+{
+ hello h;
+ h.say (msg);
+}
diff --git a/examples/m4/libhello/test/driver.hxx.m4 b/examples/m4/libhello/test/driver.hxx.m4
new file mode 100644
index 0000000..366ea66
--- /dev/null
+++ b/examples/m4/libhello/test/driver.hxx.m4
@@ -0,0 +1,5 @@
+dnl
+dnl There aren't any macro expansions; it's just an example.
+dnl
+
+char const* const msg = "Hey, hey, hey!";
diff --git a/examples/m4/libhello/test/makefile b/examples/m4/libhello/test/makefile
new file mode 100644
index 0000000..7fce1ea
--- /dev/null
+++ b/examples/m4/libhello/test/makefile
@@ -0,0 +1,70 @@
+# file : examples/cxx/hello/libhello/test/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-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
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+hello.l := $(out_root)/hello/hello.l
+hello.l.cpp-options := $(out_root)/hello/hello.l.cpp-options
+
+driver := $(out_base)/driver
+clean := $(out_base)/.clean
+test := $(out_base)/.test
+
+
+# Build.
+#
+$(driver): $(cxx_obj) $(hello.l)
+
+$(cxx_obj) $(cxx_od): $(hello.l.cpp-options)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
+
+$(call -include,$(cxx_od))
+
+
+# Test.
+#
+.PHONY: $(test)
+
+$(test): $(driver)
+ $<
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(out_base)/driver.hxx.m4.clean
+
+
+# Aliases.
+#
+ifdef %interactive%
+
+.PHONY: clean test
+
+test: $(test)
+clean: $(clean)
+
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/m4/m4.make)
+
+
+# Import build rules.
+#
+$(call import,$(src_root)/hello/makefile)