aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hello/libhello
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cxx/hello/libhello')
-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
11 files changed, 311 insertions, 0 deletions
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)