From d7b7e218bfe92516f525568a6c1c9e1a9eb241fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 5 Feb 2010 18:01:45 +0200 Subject: Start tracking build with git --- examples/m4/libhello/build/bootstrap.make | 8 ++++ examples/m4/libhello/hello/hello.cxx | 9 ++++ examples/m4/libhello/hello/hello.hxx.m4 | 10 +++++ examples/m4/libhello/hello/makefile | 71 +++++++++++++++++++++++++++++++ examples/m4/libhello/makefile | 39 +++++++++++++++++ examples/m4/libhello/test/driver.cxx | 10 +++++ examples/m4/libhello/test/driver.hxx.m4 | 5 +++ examples/m4/libhello/test/makefile | 70 ++++++++++++++++++++++++++++++ 8 files changed, 222 insertions(+) create mode 100644 examples/m4/libhello/build/bootstrap.make create mode 100644 examples/m4/libhello/hello/hello.cxx create mode 100644 examples/m4/libhello/hello/hello.hxx.m4 create mode 100644 examples/m4/libhello/hello/makefile create mode 100644 examples/m4/libhello/makefile create mode 100644 examples/m4/libhello/test/driver.cxx create mode 100644 examples/m4/libhello/test/driver.hxx.m4 create mode 100644 examples/m4/libhello/test/makefile (limited to 'examples/m4') 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 +# 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 + +#include + +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 +# 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 +# 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 + +#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 +# 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) -- cgit v1.1