diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/.gitignore | 1 | ||||
-rw-r--r-- | examples/build/.gitignore | 1 | ||||
-rw-r--r-- | examples/build/bootstrap.build | 9 | ||||
-rw-r--r-- | examples/build/root.build | 27 | ||||
-rw-r--r-- | examples/buildfile | 7 | ||||
-rw-r--r-- | examples/features/.gitignore | 1 | ||||
-rw-r--r-- | examples/features/buildfile | 11 | ||||
-rw-r--r-- | examples/features/makefile | 72 | ||||
-rw-r--r-- | examples/file/.gitignore | 1 | ||||
-rw-r--r-- | examples/file/buildfile | 14 | ||||
-rw-r--r-- | examples/file/makefile | 74 | ||||
-rw-r--r-- | examples/hello/.gitignore | 1 | ||||
-rw-r--r-- | examples/hello/buildfile | 12 | ||||
-rw-r--r-- | examples/hello/makefile | 72 |
14 files changed, 85 insertions, 218 deletions
diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000..e54525b --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +driver diff --git a/examples/build/.gitignore b/examples/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/examples/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/examples/build/bootstrap.build b/examples/build/bootstrap.build new file mode 100644 index 0000000..c67bb12 --- /dev/null +++ b/examples/build/bootstrap.build @@ -0,0 +1,9 @@ +# file : examples/build/bootstrap.build +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +project = # Unnamed subproject. + +using config +using dist +using test diff --git a/examples/build/root.build b/examples/build/root.build new file mode 100644 index 0000000..8c33a1c --- /dev/null +++ b/examples/build/root.build @@ -0,0 +1,27 @@ +# file : examples/build/root.build +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +cxx.std = 11 + +using cxx + +hxx{*}: extension = hxx +ixx{*}: extension = ixx +txx{*}: extension = txx +cxx{*}: extension = cxx + +# Load cli module. It must be available from the system or from the base +# project. Generating files with cli is a part of the examples, so distributing +# pre-generated files would be meaningless. +# +# @@ How to initialize the module to use a base project cli executable by +# default (if present and not configured to use another one)? Should it be +# assignment like 'config.cli = $out_root/../cli/cli' prior 'using config' +# in bootstrap.build, but what if it doesn't exist? +# +using cli + +# Every exe{} in this subproject is by default a test. +# +exe{*}: test = true diff --git a/examples/buildfile b/examples/buildfile new file mode 100644 index 0000000..3bd38c8 --- /dev/null +++ b/examples/buildfile @@ -0,0 +1,7 @@ +# file : examples/buildfile +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +d = features/ file/ hello/ +./: $d doc{README} +include $d diff --git a/examples/features/.gitignore b/examples/features/.gitignore new file mode 100644 index 0000000..c6e608b --- /dev/null +++ b/examples/features/.gitignore @@ -0,0 +1 @@ +options.?xx diff --git a/examples/features/buildfile b/examples/features/buildfile new file mode 100644 index 0000000..3b7b1dc --- /dev/null +++ b/examples/features/buildfile @@ -0,0 +1,11 @@ +# file : examples/features/buildfile +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +exe{driver}: cxx{driver} {hxx ixx cxx}{options} doc{README} + +cxx.poptions =+ -I$out_base + +# Generated options parser. +# +{hxx ixx cxx}{options}: cli{options} diff --git a/examples/features/makefile b/examples/features/makefile deleted file mode 100644 index 9b7ceac..0000000 --- a/examples/features/makefile +++ /dev/null @@ -1,72 +0,0 @@ -# file : examples/features/makefile -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : MIT; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make - -cli := options.cli -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -clean := $(out_base)/.clean - -# Build. -# -$(driver): $(obj) - -$(obj) $(dep): cpp_options := -I$(out_base) - -genf := $(cli:.cli=.hxx) $(cli:.cli=.ixx) $(cli:.cli=.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): cli := $(out_root)/cli/cli -$(gen): $(out_root)/cli/cli - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - -# Install -# -$(install): path := $(subst $(src_root)/,,$(src_base)) -$(install): - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx) - $(call install-data,$(src_base)/options.cli,$(install_doc_dir)/cli/$(path)/options.cli) - $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(cli:.cli=.cxx.cli.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(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)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(scf_root)/cli/cli-cxx.make) - -# Dependencies. -# -$(call import,$(src_root)/cli/makefile) diff --git a/examples/file/.gitignore b/examples/file/.gitignore new file mode 100644 index 0000000..c6e608b --- /dev/null +++ b/examples/file/.gitignore @@ -0,0 +1 @@ +options.?xx diff --git a/examples/file/buildfile b/examples/file/buildfile new file mode 100644 index 0000000..d26a9d6 --- /dev/null +++ b/examples/file/buildfile @@ -0,0 +1,14 @@ +# file : examples/file/buildfile +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +exe{driver}: cxx{driver} {hxx ixx cxx}{options} doc{README} file{test.ops} +exe{driver}: test.arguments = --options-file $src_base/test.ops + +cxx.poptions =+ -I$out_base + +# Generated options parser. +# +{hxx ixx cxx}{options}: cli{options} + +cli.options = --generate-file-scanner diff --git a/examples/file/makefile b/examples/file/makefile deleted file mode 100644 index ba1a760..0000000 --- a/examples/file/makefile +++ /dev/null @@ -1,74 +0,0 @@ -# file : examples/file/makefile -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : MIT; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make - -cli := options.cli -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -clean := $(out_base)/.clean - -# Build. -# -$(driver): $(obj) - -$(obj) $(dep): cpp_options := -I$(out_base) - -genf := $(cli:.cli=.hxx) $(cli:.cli=.ixx) $(cli:.cli=.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): cli := $(out_root)/cli/cli -$(gen): cli_options += --generate-file-scanner -$(gen): $(out_root)/cli/cli - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - -# Install -# -$(install): path := $(subst $(src_root)/,,$(src_base)) -$(install): - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx) - $(call install-data,$(src_base)/options.cli,$(install_doc_dir)/cli/$(path)/options.cli) - $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README) - $(call install-data,$(src_base)/test.ops,$(install_doc_dir)/cli/$(path)/test.ops) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(cli:.cli=.cxx.cli.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(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)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(scf_root)/cli/cli-cxx.make) - -# Dependencies. -# -$(call import,$(src_root)/cli/makefile) diff --git a/examples/hello/.gitignore b/examples/hello/.gitignore new file mode 100644 index 0000000..d73130a --- /dev/null +++ b/examples/hello/.gitignore @@ -0,0 +1 @@ +hello.?xx diff --git a/examples/hello/buildfile b/examples/hello/buildfile new file mode 100644 index 0000000..f45001d --- /dev/null +++ b/examples/hello/buildfile @@ -0,0 +1,12 @@ +# file : examples/hello/buildfile +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +exe{driver}: cxx{driver} {hxx ixx cxx}{hello} doc{README} +exe{driver}: test.arguments = --greeting Hi John Jane + +cxx.poptions =+ -I$out_base + +# Generated options parser. +# +{hxx ixx cxx}{hello}: cli{hello} diff --git a/examples/hello/makefile b/examples/hello/makefile deleted file mode 100644 index cd8d29d..0000000 --- a/examples/hello/makefile +++ /dev/null @@ -1,72 +0,0 @@ -# file : examples/hello/makefile -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -# license : MIT; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make - -cli := hello.cli -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -clean := $(out_base)/.clean - -# Build. -# -$(driver): $(obj) - -$(obj) $(dep): cpp_options := -I$(out_base) - -genf := $(cli:.cli=.hxx) $(cli:.cli=.ixx) $(cli:.cli=.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): cli := $(out_root)/cli/cli -$(gen): $(out_root)/cli/cli - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - -# Install -# -$(install): path := $(subst $(src_root)/,,$(src_base)) -$(install): - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx) - $(call install-data,$(src_base)/hello.cli,$(install_doc_dir)/cli/$(path)/hello.cli) - $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(cli:.cli=.cxx.cli.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(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)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(scf_root)/cli/cli-cxx.make) - -# Dependencies. -# -$(call import,$(src_root)/cli/makefile) |