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/cxx/hello/hello/build/bootstrap.make | 8 +++ examples/cxx/hello/hello/build/import/libhello | 1 + examples/cxx/hello/hello/hello.cxx | 8 +++ examples/cxx/hello/hello/makefile | 71 ++++++++++++++++++++++ examples/cxx/hello/libhello/build/bootstrap.make | 8 +++ .../hello/libhello/build/export/libhello/stub.make | 10 +++ .../build/import/libhello/configuration-rules.make | 15 +++++ .../hello/libhello/build/import/libhello/configure | 54 ++++++++++++++++ .../hello/libhello/build/import/libhello/stub.make | 30 +++++++++ examples/cxx/hello/libhello/libhello/hello.cxx | 9 +++ examples/cxx/hello/libhello/libhello/hello.hxx | 6 ++ examples/cxx/hello/libhello/libhello/makefile | 65 ++++++++++++++++++++ examples/cxx/hello/libhello/makefile | 39 ++++++++++++ examples/cxx/hello/libhello/test/driver.cxx | 8 +++ examples/cxx/hello/libhello/test/makefile | 67 ++++++++++++++++++++ examples/cxx/multidir/bar/bar.cxx | 4 ++ examples/cxx/multidir/build/bootstrap.make | 8 +++ examples/cxx/multidir/driver.cxx | 4 ++ examples/cxx/multidir/foo/foo.cxx | 4 ++ examples/cxx/multidir/makefile | 47 ++++++++++++++ 20 files changed, 466 insertions(+) create mode 100644 examples/cxx/hello/hello/build/bootstrap.make create mode 120000 examples/cxx/hello/hello/build/import/libhello create mode 100644 examples/cxx/hello/hello/hello.cxx create mode 100644 examples/cxx/hello/hello/makefile create mode 100644 examples/cxx/hello/libhello/build/bootstrap.make create mode 100644 examples/cxx/hello/libhello/build/export/libhello/stub.make create mode 100644 examples/cxx/hello/libhello/build/import/libhello/configuration-rules.make create mode 100755 examples/cxx/hello/libhello/build/import/libhello/configure create mode 100644 examples/cxx/hello/libhello/build/import/libhello/stub.make create mode 100644 examples/cxx/hello/libhello/libhello/hello.cxx create mode 100644 examples/cxx/hello/libhello/libhello/hello.hxx create mode 100644 examples/cxx/hello/libhello/libhello/makefile create mode 100644 examples/cxx/hello/libhello/makefile create mode 100644 examples/cxx/hello/libhello/test/driver.cxx create mode 100644 examples/cxx/hello/libhello/test/makefile create mode 100644 examples/cxx/multidir/bar/bar.cxx create mode 100644 examples/cxx/multidir/build/bootstrap.make create mode 100644 examples/cxx/multidir/driver.cxx create mode 100644 examples/cxx/multidir/foo/foo.cxx create mode 100644 examples/cxx/multidir/makefile (limited to 'examples/cxx') 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 +# 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 +# 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 +# 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 +# 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 +# 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 +# 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 +# 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 + +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 +# 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 +# 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 +# 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 +# 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 +# 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) -- cgit v1.1