diff options
Diffstat (limited to 'build-0.3')
140 files changed, 2135 insertions, 260 deletions
diff --git a/build-0.3/abspath.make b/build-0.3/abspath.make index 428608c..e1ef881 100644 --- a/build-0.3/abspath.make +++ b/build-0.3/abspath.make @@ -1,6 +1,5 @@ # file : build/abspath.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file .PHONY: FORCE diff --git a/build-0.3/bootstrap.make b/build-0.3/bootstrap.make index c45f952..44eb57e 100644 --- a/build-0.3/bootstrap.make +++ b/build-0.3/bootstrap.make @@ -1,10 +1,7 @@ # file : build/bootstrap.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file - - # First time bootstrap.make is read # ifndef %makefile% @@ -61,7 +58,16 @@ export MAKE # also it will be consistent. # -%makefile% := $(abspath $(firstword $(MAKEFILE_LIST))) +# By convention, the makefile name is the second or third last word from +# the end. If it is the third, then the second one should be end with +# bootstrap.make +# +%makefile% := $(subst $(lastword $(MAKEFILE_LIST)),,$(MAKEFILE_LIST)) +ifneq ($(filter %bootstrap.make,$(lastword $(%makefile%))),) +%makefile% := $(subst $(lastword $(%makefile%)),,$(%makefile%)) +endif +%makefile% := $(abspath $(lastword $(%makefile%))) + %makefile_realpath% := $(realpath $(%makefile%)) @@ -91,21 +97,21 @@ $(call include-search-dirs,$1,$(wordlist 2,$(words $2),$2)))) endef # Test if $1 is a 'foreign' makefile, i.e., does not reside in -# src_root, out_root, or bld_root. +# src_root, out_root, or bld_root. Use shadows for src and out +# roots to catch cases where these were reset before inclusion. +# This happens in import stubs. # %frame_exclude% += include-test-foreign define include-test-foreign -$(if $(%foreign%),t,\ -$(if $(filter $(bld_root)/% $(src_root)/% $(out_root)/%,$1),,t)) +$(if $(%foreign%),t,$(if $(filter $(bld_root)/% $(src_root_shadow)/% $(out_root_shadow)/%,$1),,t)) endef - %frame_exclude% += include-body define include-body %interactive% := %makefile% := $(call include-find-makefile,$2) -%makefile_realpath% := $(realpath $(%makefile%)) -%foreign% := $(call include-test-foreign,$(%makefile%)) +%makefile_realpath% := $$(realpath $$(%makefile%)) +%foreign% := $$(call include-test-foreign,$$(%makefile%)) $1 $$(if $$(%makefile%),$$(%makefile%),$2) @@ -154,7 +160,7 @@ define include-once-file-body %interactive% := %makefile% := $2 %makefile_realpath% := $(realpath $2) -%foreign% := $(call include-test-foreign,$(%makefile%)) +%foreign% := $$(call include-test-foreign,$$(%makefile%)) %included_files% += $$(%makefile_realpath%) @@ -185,7 +191,7 @@ define include-once-value-body %interactive% := %makefile% := $2 %makefile_realpath% := $(realpath $2) -%foreign% := $(call include-test-foreign,$(%makefile%)) +%foreign% := $$(call include-test-foreign,$$(%makefile%)) %include_once_$$(%makefile_realpath%)% += $7 @@ -257,7 +263,10 @@ src_base := $(abspath $(dir $(%makefile%))) ifneq ($(src_root),$(src_base)) -ifeq ($(origin out_root),undefined) +# In recursive make invocation, out_root may come from the environment +# in which case we need to override it. +# +ifneq ($(origin out_root),file) out_root := $(abspath $(patsubst \ %$(subst $(src_root)/,,$(src_base)),%,$(CURDIR))) endif @@ -266,7 +275,10 @@ out_base := $(out_root)/$(subst $(src_root)/,,$(src_base)) else -ifeq ($(origin out_root),undefined) +# In recursive make invocation, out_root may come from the environment +# in which case we need to override it. +# +ifneq ($(origin out_root),file) out_root := $(abspath $(CURDIR)) endif @@ -277,15 +289,20 @@ endif scf_root := $(src_root)/build dcf_root := $(out_root)/build +src_root_shadow := $(src_root) +out_root_shadow := $(out_root) + $(out_root)/%: export out_root := $(out_root) $(out_root)/%: export src_root := $(src_root) $(out_root)/%: export scf_root := $(scf_root) $(out_root)/%: export dcf_root := $(dcf_root) $(out_root)/%: export project_name := $(project_name) +# @@ Why do I need out_root here? +# $(out_base)/%: out_root := $(out_root) -$(out_base)/%: out_base := $(out_base) -$(out_base)/%: src_base := $(src_base) +$(out_base)/%: export out_base := $(out_base) +$(out_base)/%: export src_base := $(src_base) ifdef build_debug @@ -324,18 +341,45 @@ ifneq ($(bld_root),$(scf_root)) $(call -include,$(scf_root)/configuration-static.make) endif - # `disfigure' target. # .PHONY: disfigure +.PHONY: $(dcf_root)/.disfigure $(out_root)/.disfigure disfigure:: $(build_absolute_clean_target) +disfigure:: $(dcf_root)/.disfigure +disfigure:: $(out_root)/.disfigure + +ifneq ($(out_root),$(out_base)) +.PHONY: $(out_base)/.disfigure +$(out_root)/.disfigure:: $(out_base)/.disfigure +endif -#@@ Is there a better way? +# Clean up generated makefiles. # -ifeq ($(.DEFAULT_GOAL),disfigure) -.DEFAULT_GOAL := +ifndef %foreign% +ifneq ($(out_root),$(src_root)) +$(out_base)/.disfigure:: + $(call message, rm $$1,rm -f $$1,$(out_base)/makefile) +endif endif -# Dynamic configuration. +# Dynamic configuration (interactive check is to make sure we only do +# this once). # +ifdef %interactive% +ifneq ($(out_root),$(src_root)) + +$(call -include,$(dcf_root)/bootstrap-dynamic.make) + +$(dcf_root)/bootstrap-dynamic.make: | $(dcf_root)/. + $(call message,,echo "src_root := $(src_root)" >$@) + +$(dcf_root)/.disfigure:: + $(call message, rm $$1,rm -f $$1,$(dcf_root)/bootstrap-dynamic.make) +endif +endif + +ifeq ($(.DEFAULT_GOAL),disfigure) +.DEFAULT_GOAL := +endif diff --git a/build-0.3/c/c-d.make b/build-0.3/c/c-d.make index 446d643..fdba684 100644 --- a/build-0.3/c/c-d.make +++ b/build-0.3/c/c-d.make @@ -1,6 +1,5 @@ # file : build/c/c-d.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/configuration.make) diff --git a/build-0.3/c/c-o.make b/build-0.3/c/c-o.make index 0e6a532..d389fdd 100644 --- a/build-0.3/c/c-o.make +++ b/build-0.3/c/c-o.make @@ -1,6 +1,5 @@ # file : build/c/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/configuration.make) diff --git a/build-0.3/c/configuration-rules.make b/build-0.3/c/configuration-rules.make index 836fa1d..5663065 100644 --- a/build-0.3/c/configuration-rules.make +++ b/build-0.3/c/configuration-rules.make @@ -1,6 +1,5 @@ # file : build/c/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/c/configuration-dynamic.make: | $(dcf_root)/c/. @@ -12,7 +11,7 @@ $(dcf_root)/c/configuration-dynamic.make: | $(dcf_root)/c/. ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/c/configuration-dynamic.make,\ rm -f $(dcf_root)/c/configuration-dynamic.make) diff --git a/build-0.3/c/configuration-static.make b/build-0.3/c/configuration-static.make index d95ebfa..c226a36 100644 --- a/build-0.3/c/configuration-static.make +++ b/build-0.3/c/configuration-static.make @@ -1,6 +1,5 @@ # file : build/c/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file c_h_suffix := h diff --git a/build-0.3/c/configuration.make b/build-0.3/c/configuration.make index 97da2f0..e47731c 100644 --- a/build-0.3/c/configuration.make +++ b/build-0.3/c/configuration.make @@ -1,6 +1,5 @@ # file : build/c/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/configuration-rules.make,$(dcf_root)) @@ -31,11 +30,11 @@ $(out_root)/%: c_optimize := $(c_optimize) $(out_root)/%: c_debug := $(c_debug) $(out_root)/%: c_rpath := $(c_rpath) -$(out_root)/%: c_pp_extra_options := $(c_pp_extra_options) -$(out_root)/%: c_extra_options := $(c_extra_options) -$(out_root)/%: c_ld_extra_options := $(c_ld_extra_options) -$(out_root)/%: c_extra_libs := $(c_extra_libs) -$(out_root)/%: c_extra_lib_paths := $(c_extra_lib_paths) +$(out_root)/%: c_pp_extra_options := $(c_pp_extra_options) $(c_pp_cmd_options) +$(out_root)/%: c_extra_options := $(c_extra_options) $(c_cmd_options) +$(out_root)/%: c_ld_extra_options := $(c_ld_extra_options) $(c_ld_cmd_options) +$(out_root)/%: c_extra_libs := $(c_extra_libs) $(c_cmd_libs) +$(out_root)/%: c_extra_lib_paths := $(c_extra_lib_paths) $(c_cmd_lib_paths) else diff --git a/build-0.3/c/configure b/build-0.3/c/configure index 6281fa2..a294a0c 100755 --- a/build-0.3/c/configure +++ b/build-0.3/c/configure @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/c/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/c/cpp-options.make b/build-0.3/c/cpp-options.make index 8956d41..d6246a3 100644 --- a/build-0.3/c/cpp-options.make +++ b/build-0.3/c/cpp-options.make @@ -1,6 +1,5 @@ # file : build/c/cpp-options.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(out_base)/%.cpp-options: c-cpp-options-expand-impl = $(if $1,cat $1 >>$2) diff --git a/build-0.3/c/generic/c-d.make b/build-0.3/c/generic/c-d.make index 8f77d50..8933d7d 100644 --- a/build-0.3/c/generic/c-d.make +++ b/build-0.3/c/generic/c-d.make @@ -1,6 +1,5 @@ # file : build/c/generic/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/generic/configuration.make) diff --git a/build-0.3/c/generic/c-o.make b/build-0.3/c/generic/c-o.make index 7b6e622..d340837 100644 --- a/build-0.3/c/generic/c-o.make +++ b/build-0.3/c/generic/c-o.make @@ -1,6 +1,5 @@ # file : build/c/generic/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/c/generic/configuration-rules.make b/build-0.3/c/generic/configuration-rules.make index 5fa9117..05e7a42 100644 --- a/build-0.3/c/generic/configuration-rules.make +++ b/build-0.3/c/generic/configuration-rules.make @@ -1,6 +1,5 @@ # file : build/c/generic/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/c/generic/configuration-dynamic.make: | $(dcf_root)/c/generic/. @@ -8,7 +7,7 @@ $(dcf_root)/c/generic/configuration-dynamic.make: | $(dcf_root)/c/generic/. ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/c/generic/configuration-dynamic.make,\ rm -f $(dcf_root)/c/generic/configuration-dynamic.make) diff --git a/build-0.3/c/generic/configuration-sl-rules.make b/build-0.3/c/generic/configuration-sl-rules.make index e685be6..147cb1d 100644 --- a/build-0.3/c/generic/configuration-sl-rules.make +++ b/build-0.3/c/generic/configuration-sl-rules.make @@ -1,6 +1,5 @@ # file : build/c/generic/configuration-sl-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/c/generic/configuration-sl-dynamic.make: | $(dcf_root)/c/generic/. @@ -8,7 +7,7 @@ $(dcf_root)/c/generic/configuration-sl-dynamic.make: | $(dcf_root)/c/generic/. ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/c/generic/configuration-sl-dynamic.make,\ rm -f $(dcf_root)/c/generic/configuration-sl-dynamic.make) diff --git a/build-0.3/c/generic/configuration-sl.make b/build-0.3/c/generic/configuration-sl.make index b3a18a8..136186f 100644 --- a/build-0.3/c/generic/configuration-sl.make +++ b/build-0.3/c/generic/configuration-sl.make @@ -1,6 +1,5 @@ # file : build/c/generic/configuration-sl.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/generic/configuration-sl-rules.make,$(dcf_root)) diff --git a/build-0.3/c/generic/configuration.make b/build-0.3/c/generic/configuration.make index 95e79f8..1881c5c 100644 --- a/build-0.3/c/generic/configuration.make +++ b/build-0.3/c/generic/configuration.make @@ -1,6 +1,5 @@ # file : build/c/generic/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/generic/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/c/generic/configure b/build-0.3/c/generic/configure index 76be8df..dae8d72 100755 --- a/build-0.3/c/generic/configure +++ b/build-0.3/c/generic/configure @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/c/generic/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/c/generic/configure-sl b/build-0.3/c/generic/configure-sl index 5500e8b..10064cb 100755 --- a/build-0.3/c/generic/configure-sl +++ b/build-0.3/c/generic/configure-sl @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/c/generic/configure-sl -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/c/generic/o-e.make b/build-0.3/c/generic/o-e.make index 4a88a0f..a607239 100644 --- a/build-0.3/c/generic/o-e.make +++ b/build-0.3/c/generic/o-e.make @@ -1,6 +1,5 @@ # file : build/c/generic/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/generic/configuration.make) diff --git a/build-0.3/c/generic/o-l.make b/build-0.3/c/generic/o-l.make index cee21af..bdae9fc 100644 --- a/build-0.3/c/generic/o-l.make +++ b/build-0.3/c/generic/o-l.make @@ -1,6 +1,5 @@ # file : build/c/generic/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/generic/configuration.make) diff --git a/build-0.3/c/gnu/c-d.make b/build-0.3/c/gnu/c-d.make index d7e6c57..bc7411f 100644 --- a/build-0.3/c/gnu/c-d.make +++ b/build-0.3/c/gnu/c-d.make @@ -1,6 +1,5 @@ # file : build/c/gnu/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/c/gnu/c-o.make b/build-0.3/c/gnu/c-o.make index 9f5ecdd..46eb1da 100644 --- a/build-0.3/c/gnu/c-o.make +++ b/build-0.3/c/gnu/c-o.make @@ -1,6 +1,5 @@ # file : build/c/gnu/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/c/gnu/configuration-rules.make b/build-0.3/c/gnu/configuration-rules.make index 478db2d..cb25dfe 100644 --- a/build-0.3/c/gnu/configuration-rules.make +++ b/build-0.3/c/gnu/configuration-rules.make @@ -1,14 +1,14 @@ # file : build/c/gnu/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/c/gnu/configuration-dynamic.make: | $(dcf_root)/c/gnu/. - $(call message,,$(bld_root)/c/gnu/configure $@ $(c_optimize)) + $(call message,,$(bld_root)/c/gnu/configure $@ $(c_optimize) \ +"$(c_extra_options)" "$(c_ld_extra_options)") ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/c/gnu/configuration-dynamic.make,\ rm -f $(dcf_root)/c/gnu/configuration-dynamic.make) diff --git a/build-0.3/c/gnu/configuration-static.make b/build-0.3/c/gnu/configuration-static.make index eb00863..e9be2b9 100644 --- a/build-0.3/c/gnu/configuration-static.make +++ b/build-0.3/c/gnu/configuration-static.make @@ -1,4 +1,3 @@ # file : build/c/gnu/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file diff --git a/build-0.3/c/gnu/configuration.make b/build-0.3/c/gnu/configuration.make index c2e4a32..32aaf97 100644 --- a/build-0.3/c/gnu/configuration.make +++ b/build-0.3/c/gnu/configuration.make @@ -1,6 +1,5 @@ # file : build/c/gnu/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/gnu/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/c/gnu/configure b/build-0.3/c/gnu/configure index 5695ba4..713f091 100755 --- a/build-0.3/c/gnu/configure +++ b/build-0.3/c/gnu/configure @@ -1,12 +1,13 @@ #! /usr/bin/env bash # file : build/c/gnu/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file # $2 optimize (y/n) +# $3 c_extra_options +# $4 c_ld_extra_options # # bld_root - build root # project_name - project name @@ -27,8 +28,32 @@ $echo "'/usr/local/bin/gcc' or 'distcc gcc'." $echo c_gnu=`read_path --command gcc` -c_gnu_libraries=`$c_gnu -print-search-dirs | sed -e 's/libraries: =//p' -e d` +# Pass c_extra_options and c_ld_extra_options since those can affect the +# search paths (e.g., -m32) and target. +# +c_gnu_libraries=`$c_gnu $3 $4 -print-search-dirs | sed -e 's/libraries: =//p' -e d` + +c_gnu_target=`$c_gnu $3 $4 -dumpmachine` +c_gnu_target=`$bld_root/system/config.sub "$c_gnu_target"` + +if [ $? != 0 ]; then + $echo "unable to canonicalize target system '$c_gnu_target'" + exit 1 +fi + +c_gnu_target_cpu=`echo $c_gnu_target | cut -f 1 -d -` +c_gnu_target_mf=`echo $c_gnu_target | cut -f 2 -d -` +c_gnu_target_kernel=`echo $c_gnu_target | cut -f 3 -d -` +c_gnu_target_os=`echo $c_gnu_target | cut -f 4 -d -` + +if [ -z "$c_gnu_target_os" ]; then + + # Old format: cpu-mf-os + # + c_gnu_target_os=$c_gnu_target_kernel + c_gnu_target_kernel= +fi optimization= @@ -50,6 +75,11 @@ if [ "$2" == "y" ]; then fi -echo "c_gnu := $c_gnu" > $1 -echo "c_gnu_libraries := $c_gnu_libraries" >> $1 +echo "c_gnu := $c_gnu" > $1 +echo "c_gnu_libraries := $c_gnu_libraries" >> $1 echo "c_gnu_optimization_options := $optimization" >> $1 +echo "c_gnu_target := $c_gnu_target" >> $1 +echo "c_gnu_target_cpu := $c_gnu_target_cpu" >> $1 +echo "c_gnu_target_mf := $c_gnu_target_mf" >> $1 +echo "c_gnu_target_kernel := $c_gnu_target_kernel" >> $1 +echo "c_gnu_target_os := $c_gnu_target_os" >> $1 diff --git a/build-0.3/c/gnu/dep b/build-0.3/c/gnu/dep index 1286ce2..ecafcb1 100755 --- a/build-0.3/c/gnu/dep +++ b/build-0.3/c/gnu/dep @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/c/gnu/dep -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # Post-process generated dependency information. diff --git a/build-0.3/c/gnu/o-e.make b/build-0.3/c/gnu/o-e.make index a1da582..a54a9f3 100644 --- a/build-0.3/c/gnu/o-e.make +++ b/build-0.3/c/gnu/o-e.make @@ -1,6 +1,5 @@ # file : build/c/gnu/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/gnu/configuration.make) diff --git a/build-0.3/c/gnu/o-l.make b/build-0.3/c/gnu/o-l.make index 5e66650..5c93f0a 100644 --- a/build-0.3/c/gnu/o-l.make +++ b/build-0.3/c/gnu/o-l.make @@ -1,6 +1,5 @@ # file : build/c/gnu/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/gnu/configuration.make) @@ -42,9 +41,13 @@ $(out_base)/%.l.o.clean: else +mingw := $(if $(filter $(c_gnu_target_os),mingw32 mingw64),y,n) + $(out_base)/%.l: ld := $(c_gnu) $(out_base)/%.l: ld_options := $(c_gnu_optimization_options) $(c_gnu_debugging_options) +ifeq ($(mingw),n) $(out_base)/%.l: c_pic_options := -fPIC +endif $(out_base)/%.l: comma_ := , $(out_base)/%.l: expand-l = $(if $(subst n,,$(c_rpath)),\ @@ -56,6 +59,9 @@ $(out_base)/%.l: else $(out_base)/%.l: | $$(dir $$@). endif +ifeq ($(mingw),n) +# Standard version. +# $(call message,ld $@,$(ld) -shared \ $(c_extra_options) $(ld_options) $(c_ld_extra_options) \ -o $(@D)/lib$(basename $(@F)).so -Wl$(comma_)-soname=lib$(basename $(@F)).so \ @@ -63,9 +69,24 @@ $(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(c_extra_libs) $(call message,,echo "$(@D)/lib$(basename $(@F)).so" >$@) $(call message,,echo "rpath:$(@D)" >>$@) $(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.so %.l,$^))" | xargs -n 1 echo >>$@) +else +# MinGW version. +# + $(call message,ld $@,$(ld) -shared \ +$(c_extra_options) $(ld_options) $(c_ld_extra_options) \ +-o $(@D)/$(basename $(@F)).dll -Wl$(comma_)--out-implib$(comma_)$(@D)/lib$(basename $(@F)).a \ +$(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(c_extra_libs)) + $(call message,,echo "$(@D)/lib$(basename $(@F)).a" >$@) + $(call message,,echo "rpath:$(@D)" >>$@) + $(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.l,$^))" | xargs -n 1 echo >>$@) +endif $(out_base)/%.l.o.clean: +ifeq ($(mingw),n) $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,lib%.so,$(@F)),$(basename $(basename $@))) +else + $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,%.dll,$(@F)) $(@D)/$(patsubst %.l.o.clean,lib%.a,$(@F)),$(basename $(basename $@))) +endif endif endif diff --git a/build-0.3/c/intel/c-d.make b/build-0.3/c/intel/c-d.make index aa6a559..b4d6c80 100644 --- a/build-0.3/c/intel/c-d.make +++ b/build-0.3/c/intel/c-d.make @@ -1,6 +1,5 @@ # file : build/c/intel/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/c/intel/c-o.make b/build-0.3/c/intel/c-o.make index 3e359aa..e925b50 100644 --- a/build-0.3/c/intel/c-o.make +++ b/build-0.3/c/intel/c-o.make @@ -1,6 +1,5 @@ # file : build/c/intel/c-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/c/intel/configuration-rules.make b/build-0.3/c/intel/configuration-rules.make index e464e00..0132981 100644 --- a/build-0.3/c/intel/configuration-rules.make +++ b/build-0.3/c/intel/configuration-rules.make @@ -1,14 +1,14 @@ # file : build/c/intel/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/c/intel/configuration-dynamic.make: | $(dcf_root)/c/intel/. - $(call message,,$(bld_root)/c/intel/configure $@ $(c_optimize)) + $(call message,,$(bld_root)/c/intel/configure $@ $(c_optimize) \ +"$(c_extra_options)" "$(c_ld_extra_options)") ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/c/intel/configuration-dynamic.make,\ rm -f $(dcf_root)/c/intel/configuration-dynamic.make) diff --git a/build-0.3/c/intel/configuration-static.make b/build-0.3/c/intel/configuration-static.make index 29f44b1..c3e2d05 100644 --- a/build-0.3/c/intel/configuration-static.make +++ b/build-0.3/c/intel/configuration-static.make @@ -1,4 +1,3 @@ # file : build/c/intel/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file diff --git a/build-0.3/c/intel/configuration.make b/build-0.3/c/intel/configuration.make index 5e3e38f..4e0ec1e 100644 --- a/build-0.3/c/intel/configuration.make +++ b/build-0.3/c/intel/configuration.make @@ -1,6 +1,5 @@ # file : build/c/intel/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/intel/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/c/intel/configure b/build-0.3/c/intel/configure index 0d1382d..e829cea 100755 --- a/build-0.3/c/intel/configure +++ b/build-0.3/c/intel/configure @@ -1,12 +1,13 @@ #! /usr/bin/env bash # file : build/c/intel/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file # $2 optimize (y/n) +# $3 c_extra_options +# $4 c_ld_extra_options # # bld_root - build root # project_name - project name @@ -27,7 +28,11 @@ $echo "'/opt/intel_cc_80/bin/icc'." $echo c_intel=`read_path --command icc` -c_intel_libraries=`$c_intel -print-search-dirs | sed -e 's/libraries: =//p' -e d` + +# Pass c_extra_options and c_ld_extra_options since those can affect the +# search paths (e.g., -m32) and target. +# +c_intel_libraries=`$c_intel $3 $4 -print-search-dirs | sed -e 's/libraries: =//p' -e d` # Intel optimizes by default. # diff --git a/build-0.3/c/intel/dep b/build-0.3/c/intel/dep index 70f3b79..ead761f 100755 --- a/build-0.3/c/intel/dep +++ b/build-0.3/c/intel/dep @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/c/intel/dep -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # Post-process generated dependency information. diff --git a/build-0.3/c/intel/o-e.make b/build-0.3/c/intel/o-e.make index 7442637..0661ccc 100644 --- a/build-0.3/c/intel/o-e.make +++ b/build-0.3/c/intel/o-e.make @@ -1,6 +1,5 @@ # file : build/c/intel/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/intel/configuration.make) diff --git a/build-0.3/c/intel/o-l.make b/build-0.3/c/intel/o-l.make index 818a4ca..0ad3085 100644 --- a/build-0.3/c/intel/o-l.make +++ b/build-0.3/c/intel/o-l.make @@ -1,6 +1,5 @@ # file : build/c/intel/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/intel/configuration.make) diff --git a/build-0.3/c/o-e.make b/build-0.3/c/o-e.make index 10469a4..95f0757 100644 --- a/build-0.3/c/o-e.make +++ b/build-0.3/c/o-e.make @@ -1,6 +1,5 @@ # file : build/c/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/c/configuration.make) diff --git a/build-0.3/c/o-l.make b/build-0.3/c/o-l.make index 5ee8a0f..7f64067 100644 --- a/build-0.3/c/o-l.make +++ b/build-0.3/c/o-l.make @@ -1,6 +1,5 @@ # file : build/c/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/ld/configuration-lib.make) diff --git a/build-0.3/clean.make b/build-0.3/clean.make index 0cea632..c410853 100644 --- a/build-0.3/clean.make +++ b/build-0.3/clean.make @@ -1,6 +1,5 @@ # file : build/clean.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file #@@ Maybe create file aliases.make for standard aliases diff --git a/build-0.3/configuration-static.make b/build-0.3/configuration-static.make index 3e8b727..17d10f9 100644 --- a/build-0.3/configuration-static.make +++ b/build-0.3/configuration-static.make @@ -1,6 +1,5 @@ # file : build/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # Name of the target that cleans absolutely everything. Used as diff --git a/build-0.3/cxx/configuration-rules.make b/build-0.3/cxx/configuration-rules.make index 354791e..70fce9d 100644 --- a/build-0.3/cxx/configuration-rules.make +++ b/build-0.3/cxx/configuration-rules.make @@ -1,6 +1,5 @@ # file : build/cxx/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/cxx/configuration-dynamic.make: | $(dcf_root)/cxx/. @@ -12,7 +11,7 @@ $(dcf_root)/cxx/configuration-dynamic.make: | $(dcf_root)/cxx/. ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/cxx/configuration-dynamic.make,\ rm -f $(dcf_root)/cxx/configuration-dynamic.make) diff --git a/build-0.3/cxx/configuration-static.make b/build-0.3/cxx/configuration-static.make index b1339bf..d6c0731 100644 --- a/build-0.3/cxx/configuration-static.make +++ b/build-0.3/cxx/configuration-static.make @@ -1,6 +1,5 @@ # file : build/cxx/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file cxx_h_suffix := hxx diff --git a/build-0.3/cxx/configuration.make b/build-0.3/cxx/configuration.make index 5ad97ae..4529f62 100644 --- a/build-0.3/cxx/configuration.make +++ b/build-0.3/cxx/configuration.make @@ -1,6 +1,5 @@ # file : build/cxx/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/cxx/configuration-rules.make,$(dcf_root)) @@ -32,11 +31,11 @@ $(out_root)/%: cxx_optimize := $(cxx_optimize) $(out_root)/%: cxx_debug := $(cxx_debug) $(out_root)/%: cxx_rpath := $(cxx_rpath) -$(out_root)/%: cxx_pp_extra_options := $(cxx_pp_extra_options) -$(out_root)/%: cxx_extra_options := $(cxx_extra_options) -$(out_root)/%: cxx_ld_extra_options := $(cxx_ld_extra_options) -$(out_root)/%: cxx_extra_libs := $(cxx_extra_libs) -$(out_root)/%: cxx_extra_lib_paths := $(cxx_extra_lib_paths) +$(out_root)/%: cxx_pp_extra_options := $(cxx_pp_extra_options) $(cxx_pp_cmd_options) +$(out_root)/%: cxx_extra_options := $(cxx_extra_options) $(cxx_cmd_options) +$(out_root)/%: cxx_ld_extra_options := $(cxx_ld_extra_options) $(cxx_ld_cmd_options) +$(out_root)/%: cxx_extra_libs := $(cxx_extra_libs) $(cxx_cmd_libs) +$(out_root)/%: cxx_extra_lib_paths := $(cxx_extra_lib_paths) $(cxx_cmd_lib_paths) else diff --git a/build-0.3/cxx/configure b/build-0.3/cxx/configure index 033424b..f4607ad 100755 --- a/build-0.3/cxx/configure +++ b/build-0.3/cxx/configure @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/cxx/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/cxx/cxx-d.make b/build-0.3/cxx/cxx-d.make index 34b80c9..673b2d1 100644 --- a/build-0.3/cxx/cxx-d.make +++ b/build-0.3/cxx/cxx-d.make @@ -1,6 +1,5 @@ # file : build/cxx/cxx-d.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/configuration.make) diff --git a/build-0.3/cxx/cxx-o.make b/build-0.3/cxx/cxx-o.make index e01067f..a08b371 100644 --- a/build-0.3/cxx/cxx-o.make +++ b/build-0.3/cxx/cxx-o.make @@ -1,6 +1,5 @@ # file : build/cxx/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/configuration.make) diff --git a/build-0.3/cxx/generic/configuration-rules.make b/build-0.3/cxx/generic/configuration-rules.make index bb4fe67..2025cfc 100644 --- a/build-0.3/cxx/generic/configuration-rules.make +++ b/build-0.3/cxx/generic/configuration-rules.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/cxx/generic/configuration-dynamic.make: | $(dcf_root)/cxx/generic/. @@ -8,7 +7,7 @@ $(dcf_root)/cxx/generic/configuration-dynamic.make: | $(dcf_root)/cxx/generic/. ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/cxx/generic/configuration-dynamic.make,\ rm -f $(dcf_root)/cxx/generic/configuration-dynamic.make) diff --git a/build-0.3/cxx/generic/configuration-sl-rules.make b/build-0.3/cxx/generic/configuration-sl-rules.make index cbcf160..3630d26 100644 --- a/build-0.3/cxx/generic/configuration-sl-rules.make +++ b/build-0.3/cxx/generic/configuration-sl-rules.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/configuration-sl-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/cxx/generic/configuration-sl-dynamic.make: | $(dcf_root)/cxx/generic/. @@ -8,7 +7,7 @@ $(dcf_root)/cxx/generic/configuration-sl-dynamic.make: | $(dcf_root)/cxx/generic ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/cxx/generic/configuration-sl-dynamic.make,\ rm -f $(dcf_root)/cxx/generic/configuration-sl-dynamic.make) diff --git a/build-0.3/cxx/generic/configuration-sl.make b/build-0.3/cxx/generic/configuration-sl.make index 2a5e682..f1b75be 100644 --- a/build-0.3/cxx/generic/configuration-sl.make +++ b/build-0.3/cxx/generic/configuration-sl.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/configuration-sl.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/cxx/generic/configuration-sl-rules.make,$(dcf_root)) diff --git a/build-0.3/cxx/generic/configuration.make b/build-0.3/cxx/generic/configuration.make index b57eaaf..1816913 100644 --- a/build-0.3/cxx/generic/configuration.make +++ b/build-0.3/cxx/generic/configuration.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/cxx/generic/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/cxx/generic/configure b/build-0.3/cxx/generic/configure index 48b1b59..b590398 100755 --- a/build-0.3/cxx/generic/configure +++ b/build-0.3/cxx/generic/configure @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/cxx/generic/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/cxx/generic/configure-sl b/build-0.3/cxx/generic/configure-sl index 1c4b8b5..31df8ce 100755 --- a/build-0.3/cxx/generic/configure-sl +++ b/build-0.3/cxx/generic/configure-sl @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/cxx/generic/configure-sl -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/cxx/generic/cxx-d.make b/build-0.3/cxx/generic/cxx-d.make index 53f44b1..4a88451 100644 --- a/build-0.3/cxx/generic/cxx-d.make +++ b/build-0.3/cxx/generic/cxx-d.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/generic/configuration.make) diff --git a/build-0.3/cxx/generic/cxx-o.make b/build-0.3/cxx/generic/cxx-o.make index e88f5c6..3123dca 100644 --- a/build-0.3/cxx/generic/cxx-o.make +++ b/build-0.3/cxx/generic/cxx-o.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/cxx/generic/o-e.make b/build-0.3/cxx/generic/o-e.make index 8170da3..2f9f02e 100644 --- a/build-0.3/cxx/generic/o-e.make +++ b/build-0.3/cxx/generic/o-e.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/generic/configuration.make) diff --git a/build-0.3/cxx/generic/o-l.make b/build-0.3/cxx/generic/o-l.make index 5b29855..1e7dcff 100644 --- a/build-0.3/cxx/generic/o-l.make +++ b/build-0.3/cxx/generic/o-l.make @@ -1,6 +1,5 @@ # file : build/cxx/generic/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/generic/configuration.make) diff --git a/build-0.3/cxx/gnu/configuration-rules.make b/build-0.3/cxx/gnu/configuration-rules.make index 7598be9..6d79582 100644 --- a/build-0.3/cxx/gnu/configuration-rules.make +++ b/build-0.3/cxx/gnu/configuration-rules.make @@ -1,14 +1,14 @@ # file : build/cxx/gnu/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/cxx/gnu/configuration-dynamic.make: | $(dcf_root)/cxx/gnu/. - $(call message,,$(bld_root)/cxx/gnu/configure $@ $(cxx_optimize)) + $(call message,,$(bld_root)/cxx/gnu/configure $@ $(cxx_optimize) \ +"$(cxx_extra_options)" "$(cxx_ld_extra_options)") ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/cxx/gnu/configuration-dynamic.make,\ rm -f $(dcf_root)/cxx/gnu/configuration-dynamic.make) diff --git a/build-0.3/cxx/gnu/configuration-static.make b/build-0.3/cxx/gnu/configuration-static.make index 9a2521a..d0aee7d 100644 --- a/build-0.3/cxx/gnu/configuration-static.make +++ b/build-0.3/cxx/gnu/configuration-static.make @@ -1,4 +1,3 @@ # file : build/cxx/gnu/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file diff --git a/build-0.3/cxx/gnu/configuration.make b/build-0.3/cxx/gnu/configuration.make index 57e00e9..2e55f8b 100644 --- a/build-0.3/cxx/gnu/configuration.make +++ b/build-0.3/cxx/gnu/configuration.make @@ -1,6 +1,5 @@ # file : build/cxx/gnu/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/cxx/gnu/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/cxx/gnu/configure b/build-0.3/cxx/gnu/configure index b9c6ef6..c551713 100755 --- a/build-0.3/cxx/gnu/configure +++ b/build-0.3/cxx/gnu/configure @@ -1,12 +1,13 @@ #! /usr/bin/env bash # file : build/cxx/gnu/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file # $2 optimize (y/n) +# $3 cxx_extra_options +# $4 cxx_ld_extra_options # # bld_root - build root # project_name - project name @@ -27,8 +28,44 @@ $echo "'/usr/local/bin/g++' or 'distcc g++'." $echo cxx_gnu=`read_path --command g++` -cxx_gnu_libraries=`$cxx_gnu -print-search-dirs | sed -e 's/libraries: =//p' -e d` +# Determine the C++ standard. +# +cxx_gnu_standard=`echo "$3" | sed -e 's/.*-std=\([^ ]*\).*/\1/' -e t -e d` + +if [ -z "$cxx_gnu_standard" ]; then + cxx_gnu_standard="gnu++98" +elif [ "$cxx_gnu_standard" = "c++0x" ]; then + cxx_gnu_standard="c++11" +elif [ "$cxx_gnu_standard" = "gnu++0x" ]; then + cxx_gnu_standard="gnu++11" +fi + +# Pass cxx_extra_options and cxx_ld_extra_options since those +# can affect the search paths (e.g., -m32) and target. +# +cxx_gnu_libraries=`$cxx_gnu $3 $4 -print-search-dirs | sed -e 's/libraries: =//p' -e d` + +cxx_gnu_target=`$cxx_gnu $3 $4 -dumpmachine` +cxx_gnu_target=`$bld_root/system/config.sub "$cxx_gnu_target"` + +if [ $? != 0 ]; then + $echo "unable to canonicalize target system '$cxx_gnu_target'" + exit 1 +fi + +cxx_gnu_target_cpu=`echo $cxx_gnu_target | cut -f 1 -d -` +cxx_gnu_target_mf=`echo $cxx_gnu_target | cut -f 2 -d -` +cxx_gnu_target_kernel=`echo $cxx_gnu_target | cut -f 3 -d -` +cxx_gnu_target_os=`echo $cxx_gnu_target | cut -f 4 -d -` + +if [ -z "$cxx_gnu_target_os" ]; then + + # Old format: cpu-mf-os + # + cxx_gnu_target_os=$cxx_gnu_target_kernel + cxx_gnu_target_kernel= +fi optimization= @@ -50,6 +87,12 @@ if [ "$2" == "y" ]; then fi -echo "cxx_gnu := $cxx_gnu" > $1 -echo "cxx_gnu_libraries := $cxx_gnu_libraries" >> $1 -echo "cxx_gnu_optimization_options := $optimization" >> $1 +echo "cxx_gnu := $cxx_gnu" > $1 +echo "cxx_gnu_standard := $cxx_gnu_standard" >> $1 +echo "cxx_gnu_libraries := $cxx_gnu_libraries" >> $1 +echo "cxx_gnu_optimization_options := $optimization" >> $1 +echo "cxx_gnu_target := $cxx_gnu_target" >> $1 +echo "cxx_gnu_target_cpu := $cxx_gnu_target_cpu" >> $1 +echo "cxx_gnu_target_mf := $cxx_gnu_target_mf" >> $1 +echo "cxx_gnu_target_kernel := $cxx_gnu_target_kernel" >> $1 +echo "cxx_gnu_target_os := $cxx_gnu_target_os" >> $1 diff --git a/build-0.3/cxx/gnu/cxx-d.make b/build-0.3/cxx/gnu/cxx-d.make index 642a846..6611e67 100644 --- a/build-0.3/cxx/gnu/cxx-d.make +++ b/build-0.3/cxx/gnu/cxx-d.make @@ -1,6 +1,5 @@ # file : build/cxx/gnu/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/cxx/gnu/cxx-o.make b/build-0.3/cxx/gnu/cxx-o.make index 0320177..0b751ad 100644 --- a/build-0.3/cxx/gnu/cxx-o.make +++ b/build-0.3/cxx/gnu/cxx-o.make @@ -1,6 +1,5 @@ # file : build/cxx/gnu/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/cxx/gnu/o-e.make b/build-0.3/cxx/gnu/o-e.make index 8c233bd..c19e177 100644 --- a/build-0.3/cxx/gnu/o-e.make +++ b/build-0.3/cxx/gnu/o-e.make @@ -1,6 +1,5 @@ # file : build/cxx/gnu/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/gnu/configuration.make) diff --git a/build-0.3/cxx/gnu/o-l.make b/build-0.3/cxx/gnu/o-l.make index e378a4d..ea3e1d1 100644 --- a/build-0.3/cxx/gnu/o-l.make +++ b/build-0.3/cxx/gnu/o-l.make @@ -1,6 +1,5 @@ # file : build/cxx/gnu/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/gnu/configuration.make) @@ -42,10 +41,14 @@ $(out_base)/%.l.o.clean: else +mingw := $(if $(filter $(cxx_gnu_target_os),mingw32 mingw64),y,n) + $(out_base)/%.l: ld := $(cxx_gnu) $(out_base)/%.l: ld_options := $(cxx_gnu_optimization_options) $(cxx_gnu_debugging_options) +ifeq ($(mingw),n) $(out_base)/%.l: c_pic_options := -fPIC $(out_base)/%.l: cxx_pic_options := -fPIC +endif $(out_base)/%.l: comma_ := , $(out_base)/%.l: expand-l = $(if $(subst n,,$(cxx_rpath)),\ @@ -57,6 +60,9 @@ $(out_base)/%.l: else $(out_base)/%.l: | $$(dir $$@). endif +ifeq ($(mingw),n) +# Standard version. +# $(call message,ld $@,$(ld) -shared \ $(cxx_extra_options) $(ld_options) $(cxx_ld_extra_options) \ -o $(@D)/lib$(basename $(@F)).so -Wl$(comma_)-soname=lib$(basename $(@F)).so \ @@ -64,9 +70,24 @@ $(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(cxx_extra_lib $(call message,,echo "$(@D)/lib$(basename $(@F)).so" >$@) $(call message,,echo "rpath:$(@D)" >>$@) $(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.so %.l,$^))" | xargs -n 1 echo >>$@) +else +# MinGW version. +# + $(call message,ld $@,$(ld) -shared \ +$(cxx_extra_options) $(ld_options) $(cxx_ld_extra_options) \ +-o $(@D)/$(basename $(@F)).dll -Wl$(comma_)--out-implib$(comma_)$(@D)/lib$(basename $(@F)).a \ +$(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(cxx_extra_libs)) + $(call message,,echo "$(@D)/lib$(basename $(@F)).a" >$@) + $(call message,,echo "rpath:$(@D)" >>$@) + $(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.l,$^))" | xargs -n 1 echo >>$@) +endif $(out_base)/%.l.o.clean: +ifeq ($(mingw),n) $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,lib%.so,$(@F)),$(basename $(basename $@))) +else + $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,%.dll,$(@F)) $(@D)/$(patsubst %.l.o.clean,lib%.a,$(@F)),$(basename $(basename $@))) +endif endif endif diff --git a/build-0.3/cxx/intel/configuration-rules.make b/build-0.3/cxx/intel/configuration-rules.make index 577f2f7..873e08e 100644 --- a/build-0.3/cxx/intel/configuration-rules.make +++ b/build-0.3/cxx/intel/configuration-rules.make @@ -1,14 +1,14 @@ # file : build/cxx/intel/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/cxx/intel/configuration-dynamic.make: | $(dcf_root)/cxx/intel/. - $(call message,,$(bld_root)/cxx/intel/configure $@ $(cxx_optimize)) + $(call message,,$(bld_root)/cxx/intel/configure $@ $(cxx_optimize) \ +"$(cxx_extra_options)" "$(cxx_ld_extra_options)") ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/cxx/intel/configuration-dynamic.make,\ rm -f $(dcf_root)/cxx/intel/configuration-dynamic.make) diff --git a/build-0.3/cxx/intel/configuration-static.make b/build-0.3/cxx/intel/configuration-static.make index e619365..1db64f0 100644 --- a/build-0.3/cxx/intel/configuration-static.make +++ b/build-0.3/cxx/intel/configuration-static.make @@ -1,4 +1,3 @@ # file : build/cxx/intel/configuration-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file diff --git a/build-0.3/cxx/intel/configuration.make b/build-0.3/cxx/intel/configuration.make index eade065..c6e6867 100644 --- a/build-0.3/cxx/intel/configuration.make +++ b/build-0.3/cxx/intel/configuration.make @@ -1,6 +1,5 @@ # file : build/cxx/intel/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/cxx/intel/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/cxx/intel/configure b/build-0.3/cxx/intel/configure index ef250cf..7f79dd8 100755 --- a/build-0.3/cxx/intel/configure +++ b/build-0.3/cxx/intel/configure @@ -1,12 +1,13 @@ #! /usr/bin/env bash # file : build/cxx/intel/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file # $2 optimize (y/n) +# $3 cxx_extra_options +# $4 cxx_ld_extra_options # # bld_root - build root # project_name - project name @@ -27,7 +28,24 @@ $echo "'/opt/intel_cc_80/bin/icpc'." $echo cxx_intel=`read_path --command icpc` -cxx_intel_libraries=`$cxx_intel -print-search-dirs | sed -e 's/libraries: =//p' -e d` + +# Determine the C++ standard. Intel C++ on GNU/Linux appears to use the +# same option and values as GCC. +# +cxx_intel_standard=`echo "$3" | sed -e 's/.*-std=\([^ ]*\).*/\1/' -e t -e d` + +if [ -z "$cxx_intel_standard" ]; then + cxx_intel_standard="gnu++98" +elif [ "$cxx_intel_standard" = "c++0x" ]; then + cxx_intel_standard="c++11" +elif [ "$cxx_intel_standard" = "gnu++0x" ]; then + cxx_intel_standard="gnu++11" +fi + +# Pass cxx_extra_options and cxx_ld_extra_options since those +# can affect the search paths (e.g., -m32). +# +cxx_intel_libraries=`$cxx_intel $3 $4 -print-search-dirs | sed -e 's/libraries: =//p' -e d` # Intel optimizes by default. # diff --git a/build-0.3/cxx/intel/cxx-d.make b/build-0.3/cxx/intel/cxx-d.make index cd7b567..7c4bba2 100644 --- a/build-0.3/cxx/intel/cxx-d.make +++ b/build-0.3/cxx/intel/cxx-d.make @@ -1,6 +1,5 @@ # file : build/cxx/intel/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/cxx/intel/cxx-o.make b/build-0.3/cxx/intel/cxx-o.make index c64e2c8..db34a85 100644 --- a/build-0.3/cxx/intel/cxx-o.make +++ b/build-0.3/cxx/intel/cxx-o.make @@ -1,6 +1,5 @@ # file : build/cxx/intel/cxx-o.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/c/cpp-options.make,$(out_base)) diff --git a/build-0.3/cxx/intel/o-e.make b/build-0.3/cxx/intel/o-e.make index c92173a..5c11854 100644 --- a/build-0.3/cxx/intel/o-e.make +++ b/build-0.3/cxx/intel/o-e.make @@ -1,6 +1,5 @@ # file : build/cxx/intel/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/intel/configuration.make) diff --git a/build-0.3/cxx/intel/o-l.make b/build-0.3/cxx/intel/o-l.make index 76f8cff..0123687 100644 --- a/build-0.3/cxx/intel/o-l.make +++ b/build-0.3/cxx/intel/o-l.make @@ -1,6 +1,5 @@ # file : build/cxx/intel/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/intel/configuration.make) diff --git a/build-0.3/cxx/o-e.make b/build-0.3/cxx/o-e.make index 55486b3..47a7048 100644 --- a/build-0.3/cxx/o-e.make +++ b/build-0.3/cxx/o-e.make @@ -1,6 +1,5 @@ # file : build/cxx/o-e.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/cxx/configuration.make) diff --git a/build-0.3/cxx/o-l.make b/build-0.3/cxx/o-l.make index 5eb04d4..999833b 100644 --- a/build-0.3/cxx/o-l.make +++ b/build-0.3/cxx/o-l.make @@ -1,6 +1,5 @@ # file : build/cxx/o-l.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/ld/configuration-lib.make) diff --git a/build-0.3/cxx/standard.make b/build-0.3/cxx/standard.make new file mode 100644 index 0000000..64343d2 --- /dev/null +++ b/build-0.3/cxx/standard.make @@ -0,0 +1,35 @@ +# file : build/cxx/standard.make +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Set the cxx_standard variable to either c++98 or c++11. +# +$(call include,$(bld_root)/cxx/configuration.make) # cxx_id + +cxx_standard := + +ifdef cxx_id + $(call include,$(bld_root)/cxx/$(cxx_id)/configuration.make) # cxx_*_standard + ifeq ($(cxx_id),gnu) + ifdef cxx_gnu + ifneq ($(filter $(cxx_gnu_standard),c++11 gnu++11),) + cxx_standard := c++11 + else + cxx_standard := c++98 + endif + endif + else ifeq ($(cxx_id),intel) + ifdef cxx_intel + ifneq ($(filter $(cxx_intel_standard),c++11 gnu++11),) + cxx_standard := c++11 + else + cxx_standard := c++98 + endif + endif + else ifeq ($(cxx_id),generic) + cxx_standard := c++98 + else + $(error unknown C++ compiler $(cxx_id)) + endif + $(out_root)/%: cxx_standard := $(cxx_standard) +endif diff --git a/build-0.3/dialog.bash b/build-0.3/dialog.bash index 17cced0..b6f1ed4 100644 --- a/build-0.3/dialog.bash +++ b/build-0.3/dialog.bash @@ -1,6 +1,5 @@ # file : build/dialog.bash -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # bld_root - build root @@ -75,7 +74,7 @@ function read_value () { local r - read -p "[$1]: " r + read -e -p "[$1]: " r if [ -z "$r" ]; then r=$1 diff --git a/build-0.3/dir.make b/build-0.3/dir.make index 32227b5..ca3eb4c 100644 --- a/build-0.3/dir.make +++ b/build-0.3/dir.make @@ -1,6 +1,5 @@ # file : build/dir.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file .PRECIOUS: %/. diff --git a/build-0.3/dist.make b/build-0.3/dist.make new file mode 100644 index 0000000..b6b745a --- /dev/null +++ b/build-0.3/dist.make @@ -0,0 +1,5 @@ +# file : build/dist.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/dist/functions.make,$(out_base)) diff --git a/build-0.3/dist/functions.make b/build-0.3/dist/functions.make new file mode 100644 index 0000000..009f020 --- /dev/null +++ b/build-0.3/dist/functions.make @@ -0,0 +1,75 @@ +# file : build/dist/functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +dist_cmd := $(bld_root)/install/install + +dist_dir := $(dist_cmd) -d -m 755 +dist_data := $(dist_cmd) -p -m 644 +dist_exec := $(dist_cmd) -p -m 755 + +$(out_root)/%: dist_dir := $(dist_dir) +$(out_root)/%: dist_data := $(dist_data) +$(out_root)/%: dist_exec := $(dist_exec) + +# Arguments: +# +# $1 - files; if not an absolute path, assume relative to src_base +# $2 - optional destination directory. If not specified, +# $(dist_prefix)/<path> is used where path is computed as +# difference between src_base and src_root. +# +$(out_base)/%: dist-data = \ +$(call dist-data-body,$1,$(if $2,$2,$(dist_prefix)$(subst \ +$(src_root),,$(src_base)))) + +$(out_base)/%: dist-exec = \ +$(call dist-exec-body,$1,$(if $2,$2,$(dist_prefix)$(subst \ +$(src_root),,$(src_base)))) + +# Arguments: +# +# $1 - directory +# $2 - optional find predicates +# $3 - optional destination directory. If not specified, +# $(dist_prefix)/<path> is used where path is computed as +# difference between src_base and src_root. +# +$(out_base)/%: dist-dir = \ +$(call dist-dir-body,$1,$2,$(if $3,$3,$(dist_prefix)$(subst \ +$(src_root),,$(src_base)))) + +$(out_base)/%: dist-data-body = \ +$(call message,,$(dist_dir) $2)\ +$(foreach d,$(sort $(dir $(addprefix $2/,$(foreach f,$1,$(if \ +$(filter /%,$f), $(notdir $f), $f))))),$(literal_newline)\ +$(literal_tab)$(call message,,$(dist_dir) $d))\ +$(foreach f,$1,$(literal_newline)\ +$(literal_tab)$(call message,dist $2/$(if $(filter /%,$f),$(notdir \ +$f),$f),$(dist_data) $(if $(filter /%,$f),$f,$(src_base)/$f) $2/$(if \ +$(filter /%,$f),$(notdir $f),$f))) + +$(out_base)/%: dist-exec-body = \ +$(call message,,$(dist_dir) $2)\ +$(foreach d,$(sort $(dir $(addprefix $2/,$(foreach f,$1,$(if \ +$(filter /%,$f), $(notdir $f), $f))))),$(literal_newline)\ +$(literal_tab)$(call message,,$(dist_dir) $d))\ +$(foreach f,$1,$(literal_newline)\ +$(literal_tab)$(call message,dist $2/$(if $(filter /%,$f),$(notdir \ +$f),$f),$(dist_exec) $(if $(filter /%,$f),$f,$(src_base)/$f) $2/$(if \ +$(filter /%,$f),$(notdir $f),$f))) + +$(out_base)/%: dist-dir-body = \ +$(call message,dist $3/$1,find -L $(src_base)/$1 $2 -type f -print \ +| xargs -n 1 $(bld_root)/run-if-arg dirname \ +| sort -u \ +| sed -e 's%$(src_base)/$1\(.*\)%$3/$1\1%' \ +| xargs -n 1 $(bld_root)/run-if-arg "$(dist_dir)")$(literal_newline)\ +$(literal_tab)$(call message,,\ +find -L $(src_base)/$1 $2 -type f ! -perm -100 -print \ +| sed -e 's%$(src_base)/$1\(.*\)%$(src_base)/$1\1 $3/$1\1%' \ +| xargs -n 2 $(bld_root)/run-if-arg "$(dist_data)")$(literal_newline)\ +$(literal_tab)$(call message,,\ +find -L $(src_base)/$1 $2 -type f -perm -100 -print \ +| sed -e 's%$(src_base)/$1\(.*\)%$(src_base)/$1\1 $3/$1\1%' \ +| xargs -n 2 $(bld_root)/run-if-arg "$(dist_exec)") diff --git a/build-0.3/frame.make b/build-0.3/frame.make index bb1526c..2b16a0a 100644 --- a/build-0.3/frame.make +++ b/build-0.3/frame.make @@ -1,6 +1,5 @@ # file : build/frame.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file %frame_exclude% += CURDIR SHELL MAKEFILE_LIST MAKEFLAGS diff --git a/build-0.3/generator b/build-0.3/generator new file mode 100644 index 0000000..6ab29f2 --- /dev/null +++ b/build-0.3/generator @@ -0,0 +1,90 @@ +# file : build/generator +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# This makefile is an optional, transparent generator of "thunk" makefiles +# for the build setups with separate src and out directories. Without the +# generator, the make invocation for this setup has the following general +# form: +# +# make -C out_root/subdir -f src_root/subdir/makefile +# +# With the generator enabled, the same can be achieved with the following +# shorter command: +# +# make -C out_root/subdir +# +# Or, if the subdir directory may not yet exist, with this variant: +# +# make -C out_root dir=subdir +# +# To enable the generator, you will need to instruct make to pre-load it +# for every invocation by adding it to the MAKEFILES environment variable: +# +# export MAKEFILES=build-X.Y/generator +# +# The thunk makefiles for individual sub-directories are generated as +# needed and are automatically removed by the disfigure target. +# + +ifdef dir + +.PHONY: _all +_all: + @mkdir -p $(dir) + @$(MAKE) -C $(dir) dir= $(MAKECMDGOALS) + +ifneq ($(MAKECMDGOALS),) +.PHONY: $(MAKECMDGOALS) +$(MAKECMDGOALS): _all +else +.DEFAULT_GOAL := _all +endif + +else +ifeq ($(wildcard makefile Makefile GNUmakefile),) + +define literal_newline + + +endef + +makefile: empty := +makefile: space := $(empty) # +makefile: tab := $(empty) $(empty) +makefile: newline := $(literal_newline) + + +# Find the src_root directory. +# +# $1 - current directory +# +makefile: find = \ +$(if $1,$(if $(wildcard $1/build/bootstrap-dynamic.make),$1,$(call \ +find,$(patsubst %/,%,$(dir $1))))) + +# Convert /foo/bar to ../../. +# +# $1 - relative path from $(CURDIR) +# +makefile: path = $(subst $(space),,$(foreach d,$(subst /, ,$1/),../)) + +# $1 - relative path from $(CURDIR) +# +makefile: command_body = \ +@echo '\# Automatically generated by build.' >$@$(newline)\ +$(tab)@echo 'ifndef dir' >>$@$(newline)\ +$(tab)@echo 'override dir :=' >>$@$(newline)\ +$(tab)@echo 'include $(if $1,$(call path,$1))build/bootstrap-dynamic.make' >>$@$(newline)\ +$(tab)@echo 'include $$(src_root)$1/makefile' >>$@$(newline)\ +$(tab)@echo 'endif' >>$@ + +# $1 - output root directory or empty if none were found +# +makefile: command = $(if $1,$(call command_body,$(subst $1,,$(CURDIR)))) + +makefile: + $(call command,$(call find,$(CURDIR))) + +endif # makefile +endif # dir diff --git a/build-0.3/git/gitignore b/build-0.3/git/gitignore index a8828d7..6663e51 100755 --- a/build-0.3/git/gitignore +++ b/build-0.3/git/gitignore @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/git/gitignore -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file echo '# Generated .gitignore file; do not edit or version control.' diff --git a/build-0.3/git/gitignore.make b/build-0.3/git/gitignore.make index c42467a..931d2cd 100644 --- a/build-0.3/git/gitignore.make +++ b/build-0.3/git/gitignore.make @@ -1,6 +1,5 @@ # file : build/git/gitignore.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(out_base)/.gitignore: diff --git a/build-0.3/import.make b/build-0.3/import.make index 122aee0..82a6763 100644 --- a/build-0.3/import.make +++ b/build-0.3/import.make @@ -1,6 +1,5 @@ # file : build/import.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file diff --git a/build-0.3/install.make b/build-0.3/install.make index 213ad28..c774788 100644 --- a/build-0.3/install.make +++ b/build-0.3/install.make @@ -1,6 +1,5 @@ -# file : build/install/install.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# file : build/install.make +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include,$(bld_root)/install/configuration.make) diff --git a/build-0.3/install/configuration.make b/build-0.3/install/configuration.make index 66c9dd3..d7ece48 100644 --- a/build-0.3/install/configuration.make +++ b/build-0.3/install/configuration.make @@ -1,6 +1,5 @@ # file : build/install/configuration.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file install_prefix := /usr/local diff --git a/build-0.3/install/install b/build-0.3/install/install index 20193b6..40fe037 100755 --- a/build-0.3/install/install +++ b/build-0.3/install/install @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/install/install -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # Run native install command if available and install-sh otherwise. diff --git a/build-0.3/install/install-functions.make b/build-0.3/install/install-functions.make index 4434cbe..22f69a7 100644 --- a/build-0.3/install/install-functions.make +++ b/build-0.3/install/install-functions.make @@ -1,6 +1,5 @@ # file : build/install/install-functions.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file #@@ could just call it functions.make diff --git a/build-0.3/ld/configuration-lib-rules.make b/build-0.3/ld/configuration-lib-rules.make index 686d975..0c1a8e9 100644 --- a/build-0.3/ld/configuration-lib-rules.make +++ b/build-0.3/ld/configuration-lib-rules.make @@ -1,6 +1,5 @@ # file : build/ld/configuration-lib-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(dcf_root)/ld/configuration-lib-dynamic.make: | $(dcf_root)/ld/. @@ -9,7 +8,7 @@ $(dcf_root)/ld/configuration-lib-dynamic.make: | $(dcf_root)/ld/. ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/ld/configuration-lib-dynamic.make,\ rm -f $(dcf_root)/ld/configuration-lib-dynamic.make) diff --git a/build-0.3/ld/configuration-lib-static.make b/build-0.3/ld/configuration-lib-static.make index 5d26e8a..60eebd5 100644 --- a/build-0.3/ld/configuration-lib-static.make +++ b/build-0.3/ld/configuration-lib-static.make @@ -1,6 +1,5 @@ # file : build/ld/configuration-lib-static.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file #@@ Need to use these variables where I hardcoded those values. diff --git a/build-0.3/ld/configuration-lib.make b/build-0.3/ld/configuration-lib.make index 6b910c5..5395d64 100644 --- a/build-0.3/ld/configuration-lib.make +++ b/build-0.3/ld/configuration-lib.make @@ -1,6 +1,5 @@ # file : build/ld/configuration-lib.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/ld/configuration-lib-rules.make,$(dcf_root)) diff --git a/build-0.3/ld/configure-lib b/build-0.3/ld/configure-lib index 84a2c2b..5243357 100755 --- a/build-0.3/ld/configure-lib +++ b/build-0.3/ld/configure-lib @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/ld/configure-lib -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file diff --git a/build-0.3/literals.make b/build-0.3/literals.make index 0528793..2ae8cf7 100644 --- a/build-0.3/literals.make +++ b/build-0.3/literals.make @@ -1,6 +1,5 @@ # file : build/literals.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file literal_empty := diff --git a/build-0.3/m4/m4.make b/build-0.3/m4/m4.make index 96cd963..ef5726b 100644 --- a/build-0.3/m4/m4.make +++ b/build-0.3/m4/m4.make @@ -1,6 +1,5 @@ # file : build/m4/m4.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(out_base)/%: m4 := m4 diff --git a/build-0.3/message.make b/build-0.3/message.make index ff499e6..d7d47c4 100644 --- a/build-0.3/message.make +++ b/build-0.3/message.make @@ -1,22 +1,17 @@ # file : build/message.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file - -# @@ I should not use names like message especially if it is -# just for a convinience of a subsystem. -# -# @@ maybe I can use -message (use - in front for system -# utilities). -# +%frame_exclude% += build-message-expand-body +define build-message-expand-body +$(eval _1 = $1)$(call _1,$2,$3,$4,$5,$6,$7,$8,$9) +endef %frame_exclude% += build-message-expand define build-message-expand -$(eval _1 = $1)$(call _1,$2,$3,$4,$5,$6,$7,$8,$9) +$(call build-message-expand-body,$(subst #,\#,$1),$2,$3,$4,$5,$6,$7,$8,$9) endef - %frame_exclude% += message ifdef verbose diff --git a/build-0.3/meta/autoconf b/build-0.3/meta/autoconf new file mode 100755 index 0000000..2eb542f --- /dev/null +++ b/build-0.3/meta/autoconf @@ -0,0 +1,84 @@ +#! /usr/bin/env bash + +# file : build/meta/autoconf +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process autconf configure.ac templates. +# +# Options: +# +# -b <base-dir> +# -o <output-file> +# +# Arguments: +# +# <template-file> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +base= +output= + +while [ $# -gt 0 ]; do + case $1 in + -b) + base=$2 + shift 2 + ;; + -o) + output=$2 + shift 2 + ;; + *) + break + ;; + esac +done + +input=$1 + +if [ "$input" = "" ]; then + error "no input file" + exit 1 +fi + +if [ "$base" = "" ]; then + error "no base directory" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +m4=m4 + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + +# Find all the configuration files. +# +files=`find $base -name 'Makefile.am' -o -name '*.in' -a ! -name '*.h.in' | \ +sed -e "s%^$base/%%" | \ +sed -e 's%\.\(am\|in\)$%%' | \ +sort -u` + +export config_files=$files + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/autoconf.m4 $input >$output +chmod 644 $output diff --git a/build-0.3/meta/autoconf-functions.make b/build-0.3/meta/autoconf-functions.make new file mode 100644 index 0000000..a2a1d76 --- /dev/null +++ b/build-0.3/meta/autoconf-functions.make @@ -0,0 +1,23 @@ +# file : build/meta/autoconf-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process autoconf template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - optional template path, if doesn't start with /, assume relative +# to src_base default is $(src_base)/configure.ac +# +$(out_base)/%: meta-autoconf = \ +$(call meta-autoconf-body,$(if $1,$(if $(filter \ +/%,$1),$1,$(src_base)/$1),$(src_base)/configure.ac),$(subst \ +$(src_root),,$(src_base))) + +# $1 - template +# $2 - difference between src_base and src_root with leading '\' +# +$(out_base)/%: meta-autoconf-body = \ +$(call message,meta $(dist_prefix)$2/$(notdir $1),$(bld_root)/meta/autoconf \ +-b $(dist_prefix)$2 -o $(dist_prefix)$2/$(notdir $1) $1) diff --git a/build-0.3/meta/autoconf.m4 b/build-0.3/meta/autoconf.m4 new file mode 100644 index 0000000..8ca5b93 --- /dev/null +++ b/build-0.3/meta/autoconf.m4 @@ -0,0 +1,21 @@ +m4_divert(-1) +# file : build/meta/autoconf.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_changequote([, ]) + +m4_include(__meta_base__[/common.m4]) + +m4_define([__path_impl__], [__env_impl__([$1])]) +m4_define([__path__], [m4_equote()__path_impl__([$1])[]m4_dquote()]) + +m4_define([__file_impl__], [__env_impl__([$1])]) +m4_define([__file__], [m4_equote()__file_impl__([$1])[]m4_dquote()]) + +# Disable comments and quoting. +# +m4_changecom([]) +m4_changequote([]) + +m4_divert(0)m4_dnl diff --git a/build-0.3/meta/autoconf.make b/build-0.3/meta/autoconf.make new file mode 100644 index 0000000..984ed35 --- /dev/null +++ b/build-0.3/meta/autoconf.make @@ -0,0 +1,5 @@ +# file : build/meta/autoconf.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/autoconf-functions.make,$(out_base)) diff --git a/build-0.3/meta/automake b/build-0.3/meta/automake new file mode 100755 index 0000000..ede1958 --- /dev/null +++ b/build-0.3/meta/automake @@ -0,0 +1,64 @@ +#! /usr/bin/env bash + +# file : build/meta/automake +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process automake Makefile.am templates. +# +# Options: +# +# -o <output-file> +# +# Arguments: +# +# <template-file> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +output= + +while [ $# -gt 0 ]; do + case $1 in + -o) + output=$2 + shift 2 + ;; + *) + break + ;; + esac +done + +input=$1 + +if [ "$input" = "" ]; then + error "no input file" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +m4=m4 + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/automake.m4 $input >$output +chmod 644 $output diff --git a/build-0.3/meta/automake-functions.make b/build-0.3/meta/automake-functions.make new file mode 100644 index 0000000..2f49237 --- /dev/null +++ b/build-0.3/meta/automake-functions.make @@ -0,0 +1,23 @@ +# file : build/meta/automake-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process automake template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - optional template path, if doesn't start with /, assume relative +# to src_base default is $(src_base)/Makefile.am +# +$(out_base)/%: meta-automake = \ +$(call meta-automake-body,$(if $1,$(if $(filter \ +/%,$1),$1,$(src_base)/$1),$(src_base)/Makefile.am),$(subst \ +$(src_root),,$(src_base))) + +# $1 - template +# $2 - difference between src_base and src_root with leading '\' +# +$(out_base)/%: meta-automake-body = \ +$(call message,meta $(dist_prefix)$2/$(notdir $1),$(bld_root)/meta/automake \ +-o $(dist_prefix)$2/$(notdir $1) $1) diff --git a/build-0.3/meta/automake.m4 b/build-0.3/meta/automake.m4 new file mode 100644 index 0000000..56aa319 --- /dev/null +++ b/build-0.3/meta/automake.m4 @@ -0,0 +1,21 @@ +m4_divert(-1) +# file : build/meta/automake.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_changequote([, ]) + +m4_include(__meta_base__[/common.m4]) + +m4_define([__path_impl__], [__env_impl__([$1])]) +m4_define([__path__], [m4_equote()__path_impl__([$1])[]m4_dquote()]) + +m4_define([__file_impl__], [__env_impl__([$1])]) +m4_define([__file__], [m4_equote()__file_impl__([$1])[]m4_dquote()]) + +# Disable comments and quoting. +# +m4_changecom([]) +m4_changequote([]) + +m4_divert(0)m4_dnl diff --git a/build-0.3/meta/automake.make b/build-0.3/meta/automake.make new file mode 100644 index 0000000..67ae4ac --- /dev/null +++ b/build-0.3/meta/automake.make @@ -0,0 +1,5 @@ +# file : build/meta/automake.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/automake-functions.make,$(out_base)) diff --git a/build-0.3/meta/common.m4 b/build-0.3/meta/common.m4 new file mode 100644 index 0000000..685a74a --- /dev/null +++ b/build-0.3/meta/common.m4 @@ -0,0 +1,113 @@ +# file : build/meta/common.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# m4_strip(STRING) +# ---------------- +# Expands into STRING with tabs and spaces singled out into a single +# space, and removing leading and trailing spaces. +# +m4_define([m4_strip], +[m4_patsubst(m4_patsubst([ $1 ], [[ ]+], [ ]), [^ \(.*\) $], [[[\1]]])]) + + +# m4_normalize(STRING) +# -------------------- +# Apply m4_strip to STRING. +# +m4_define([m4_normalize], [m4_strip([$1])]) + +# m4_split(STRING, [REGEXP]) +# -------------------------- +# Split STRING into an m4 list of quoted elements. The elements are +# quoted with ] and ]. Beginning spaces and end spaces *are kept*. +# Use m4_strip to remove them. +# +# REGEXP specifies where to split. Default is [\t ]+. +# +# If STRING is empty, the result is an empty list. +# + +m4_define([m4_split], +[m4_ifelse([$1], [], [], + [$2], [ ], [m4_ifelse(m4_index([$1], [ ]), [-1], [[$1]], + [_$0([$1], [$2], [, ])])], + [$2], [], [_$0([$1], [[ ]+], [, ])], + [_$0([$1], [$2], [, ])])]) + +m4_define([_m4_split], [m4_patsubst([$1], [$2], [$3])]) + + +# Simple foreach implementation. The list elements are expected to +# be fully expanded. +# +m4_define([m4_foreach], [m4_ifelse([$2], [], [], + [m4_pushdef([$1])_$0([$1], [$3], [], $2)m4_popdef([$1])])]) +m4_define([_m4_foreach], [m4_ifelse([$#], [3], [], + [m4_define([$1], [$4])$2[]$0([$1], [$2], + m4_shift(m4_shift(m4_shift($@))))])]) + +# m4_foreach_w(VARIABLE, LIST, EXPRESSION) +# ---------------------------------------- +# Like m4_foreach, but the list is whitespace separated. +# +m4_define([m4_foreach_w], +[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])]) + +# m4_strip_nl(STRING) +# ---------------------------------------- +# Remove newlines +# +m4_define([m4_strip_nl], [m4_patsubst([$1], [ +], [])]) + +# Enable/disable quoting. +# +m4_define([m4_equote], [m4_changequote([,])]) +m4_define([m4_dquote], [m4_changequote([])]) + +# +# +m4_define([__ifelse__], + [m4_equote()m4_ifelse( + [$1], + [$2], + [m4_dquote()$3m4_equote()], + [m4_dquote()$4m4_equote()])[]m4_dquote()]) + +m4_define([__foreach__], + [m4_equote()m4_foreach( + [$1],[$2],[m4_dquote()$3m4_equote()])[]m4_dquote()]) + +m4_define([__foreach_w__], + [m4_equote()m4_foreach_w( + $1,$2,[m4_dquote()$3m4_equote()])[]m4_dquote()]) + +# +# +m4_define([__env_impl__], [m4_esyscmd([/bin/echo -n $$1])]) +m4_define([__env__], [m4_equote()__env_impl__([$1])[]m4_dquote()]) + +m4_define([__value_impl__], [__env_impl__([$1])]) +m4_define([__value__], [m4_equote()__value_impl__([$1])[]m4_dquote()]) + +m4_define([__uuid_impl__], + [m4_translit(m4_strip_nl(m4_esyscmd([uuidgen])), [a-z], [A-Z])]) +m4_define([__uuid__], [m4_equote()__uuid_impl__([$1])[]m4_dquote()]) + +m4_define([__upcase_impl__], [m4_translit([$1], [a-z], [A-Z])]) +m4_define([__upcase__], [m4_equote()__upcase_impl__([$1])[]m4_dquote()]) + +m4_define([__xml_impl__], +[m4_patsubst( + m4_patsubst( + m4_patsubst( + [$1], + [&], + [&]), + [<], + [<]), + ["], + ["])]) + +m4_define([__xml__], [m4_equote()__xml_impl__([$1])[]m4_dquote()]) diff --git a/build-0.3/meta/vc10proj b/build-0.3/meta/vc10proj new file mode 100755 index 0000000..cd6b5b3 --- /dev/null +++ b/build-0.3/meta/vc10proj @@ -0,0 +1,79 @@ +#! /usr/bin/env bash + +# file : build/meta/vc10proj +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ 10 project file templates. +# +# Options: +# +# -o <output-file> +# +# Arguments: +# +# <template-file> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +output= + +while [ $# -gt 0 ]; do + case $1 in + -o) + output=$2 + shift 2 + ;; + *) + break + ;; + esac +done + +input=$1 + +if [ "$input" = "" ]; then + error "no input file" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +m4=m4 +u2d=todos + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + + +# Determine available configurations. +# +conf=`sed -n -e \ +'s/^[ ]*<ProjectConfiguration Include="\([^"]*\)">$/"\1",/p;d' $input` +conf=`echo $conf | sed -e 's/,$//'` + +export configurations=$conf + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/vc10proj.m4 $input >$output +$u2d $output +chmod 644 $output + +$m4 -P -D__meta_base__=$meta $meta/vc10proj.m4 $input.filters >$output.filters +$u2d $output.filters +chmod 644 $output.filters diff --git a/build-0.3/meta/vc10proj-functions.make b/build-0.3/meta/vc10proj-functions.make new file mode 100644 index 0000000..8625182 --- /dev/null +++ b/build-0.3/meta/vc10proj-functions.make @@ -0,0 +1,27 @@ +# file : build/meta/vc10proj-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ project file template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3-8 - optional pairs of additional varibales and values $3=$4, $5=$6, etc +# +# +$(out_base)/%: meta-vc10proj = \ +$(call meta-vc10proj-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst $(src_root),,$(src_base)),$3,$4,$5,$6,$7,$8) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4-9 - additional varibales +# +$(out_base)/%: meta-vc10proj-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $4,$4='$5'; export $4; )$(if \ +$6,$6='$7'; export $6; )$(if $8,$8='$9'; export $8; )$(bld_root)/meta/vc10proj \ +-o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc10proj.m4 b/build-0.3/meta/vc10proj.m4 new file mode 100644 index 0000000..b151f78 --- /dev/null +++ b/build-0.3/meta/vc10proj.m4 @@ -0,0 +1,127 @@ +m4_divert(-1) +# file : build/meta/vc10proj.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_changequote([, ]) + +m4_include(__meta_base__[/common.m4]) +m4_include(__meta_base__[/windows-common.m4]) + +# header +# +m4_define([__header_entry_impl__], +[ <ClInclude Include="[$1]" />]) + +m4_define([__header_entry__], +[m4_equote()__header_entry_impl__([$1])[]m4_dquote()]) + + +m4_define([__header_entries_impl__], +[m4_foreach_w([__f], __path_impl__([$1]), [ +__header_entry_impl__(__f)])]) + +m4_define([__header_entries__], +[m4_equote()__header_entries_impl__([$1])[]m4_dquote()]) + +# header_filter +# +m4_define([__header_filter_entry_impl__], +[ <ClInclude Include="[$1]"> + <Filter>Header Files</Filter> + </ClInclude>]) + +m4_define([__header_filter_entry__], +[m4_equote()__header_filter_entry_impl__([$1])[]m4_dquote()]) + + +m4_define([__header_filter_entries_impl__], +[m4_foreach_w([__f], __path_impl__([$1]), [ +__header_filter_entry_impl__(__f)])]) + +m4_define([__header_filter_entries__], +[m4_equote()__header_filter_entries_impl__([$1])[]m4_dquote()]) + +# source +# + +# $1 - configuration +# $2 - directory +# +m4_define([__source_config_entry_impl__], +[ <ObjectFileName m4_dnl +Condition="'$(Configuration)|$(Platform)'==m4_dnl +'[]m4_patsubst([$1], ["], [])'">m4_dnl +$(IntDir)\[$2]\</ObjectFileName>]) + +m4_define([__source_entry_body__], +[m4_ifelse([$1], [$2], +[ <ClCompile Include="[$1]" />], +[ <ClCompile Include="[$1]">m4_dnl +m4_foreach([__c], +[__value_impl__([configurations])], +[ +__source_config_entry_impl__(__c, [$2])]) + </ClCompile>])]) + +m4_define([__source_entry_impl__], +[__source_entry_body__([$1], +m4_patsubst([$1], [^\(.*\)\\\(.*\)$], [\1]))]) + +m4_define([__source_entry__], +[m4_equote()__source_entry_impl__([$1])[]m4_dquote()]) + +m4_define([__source_entries_impl__], +[m4_foreach_w([__f], __path_impl__([$1]), [ +__source_entry_impl__(__f)])]) + +m4_define([__source_entries__], +[m4_equote()__source_entries_impl__([$1])[]m4_dquote()]) + +# source_filter +# +m4_define([__source_filter_entry_impl__], +[ <ClCompile Include="[$1]"> + <Filter>Source Files</Filter> + </ClCompile>]) + +m4_define([__source_filter_entry__], +[m4_equote()__source_filter_entry_impl__([$1])[]m4_dquote()]) + + +m4_define([__source_filter_entries_impl__], +[m4_foreach_w([__f], __path_impl__([$1]), [ +__source_filter_entry_impl__(__f)])]) + +m4_define([__source_filter_entries__], +[m4_equote()__source_filter_entries_impl__([$1])[]m4_dquote()]) + +# custom_build +# +m4_define([__custom_build_entry_tag_impl__], +[ <[$1] Condition="'$(Configuration)|$(Platform)'==m4_dnl +'[]m4_patsubst([$2], ["], [])'">[$3]</[$1]>]) + +m4_define([__custom_build_entry_impl__], +[ <CustomBuild Include="[$1]">m4_dnl +m4_foreach([__c], +[__value_impl__([configurations])], +[ +__custom_build_entry_tag_impl__([Message], __c, [$2]) +__custom_build_entry_tag_impl__([Command], __c, [$3]) +__custom_build_entry_tag_impl__([Outputs], __c, [$4];%(Outputs))m4_ifelse([$5], [], [], [ +__custom_build_entry_tag_impl__([AdditionalInputs], __c, [$5])])]) + </CustomBuild>]) + +# (file, cmd-description, cmd, output;output[, add-dep;add-dep]) +# +m4_define([__custom_build_entry__], +[m4_equote()__custom_build_entry_impl__([$1], +[$2], [$3], [$4], [$5])[]m4_dquote()]) + +# Disable comments and quoting. +# +m4_changecom([]) +m4_changequote([]) + +m4_divert(0)m4_dnl diff --git a/build-0.3/meta/vc10proj.make b/build-0.3/meta/vc10proj.make new file mode 100644 index 0000000..3532e6e --- /dev/null +++ b/build-0.3/meta/vc10proj.make @@ -0,0 +1,5 @@ +# file : build/meta/vc10proj.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc10proj-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc10sln-functions.make b/build-0.3/meta/vc10sln-functions.make new file mode 100644 index 0000000..cb68d82 --- /dev/null +++ b/build-0.3/meta/vc10sln-functions.make @@ -0,0 +1,29 @@ +# file : build/meta/vc10sln-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ solution template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3 - project suffix (-vc10.vcxproj by default) +# $4-9 - optional pairs of additional varibales and values $4=$5, $6=$7, etc +# +$(out_base)/%: meta-vc10sln = \ +$(call meta-vc10sln-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst \ +$(src_root),,$(src_base)),$(if $3,$3,-vc10.vcxproj),$4,$5,$6,$7,$8,$9) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4 - project suffix +# $4-10 - additional varibales +# +$(out_base)/%: meta-vc10sln-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $5,$5='$6'; export $5; )$(if \ +$7,$7='$8'; export $7; )$(if $9,$9='$(10)'; export $9; )$(bld_root)/meta/vcsln \ +-v 10 -b $(dist_prefix)$3 -e '$4' -o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc10sln.make b/build-0.3/meta/vc10sln.make new file mode 100644 index 0000000..ac4abed --- /dev/null +++ b/build-0.3/meta/vc10sln.make @@ -0,0 +1,5 @@ +# file : build/meta/vc10sln.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc10sln-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc11proj-functions.make b/build-0.3/meta/vc11proj-functions.make new file mode 100644 index 0000000..eff9091 --- /dev/null +++ b/build-0.3/meta/vc11proj-functions.make @@ -0,0 +1,27 @@ +# file : build/meta/vc11proj-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ project file template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3-8 - optional pairs of additional varibales and values $3=$4, $5=$6, etc +# +# +$(out_base)/%: meta-vc11proj = \ +$(call meta-vc11proj-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst $(src_root),,$(src_base)),$3,$4,$5,$6,$7,$8) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4-9 - additional varibales +# +$(out_base)/%: meta-vc11proj-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $4,$4='$5'; export $4; )$(if \ +$6,$6='$7'; export $6; )$(if $8,$8='$9'; export $8; )$(bld_root)/meta/vc10proj \ +-o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc11proj.make b/build-0.3/meta/vc11proj.make new file mode 100644 index 0000000..4cf98ea --- /dev/null +++ b/build-0.3/meta/vc11proj.make @@ -0,0 +1,5 @@ +# file : build/meta/vc11proj.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc11proj-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc11sln-functions.make b/build-0.3/meta/vc11sln-functions.make new file mode 100644 index 0000000..83cae1f --- /dev/null +++ b/build-0.3/meta/vc11sln-functions.make @@ -0,0 +1,29 @@ +# file : build/meta/vc11sln-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ solution template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3 - project suffix (-vc11.vcxproj by default) +# $4-9 - optional pairs of additional varibales and values $4=$5, $6=$7, etc +# +$(out_base)/%: meta-vc11sln = \ +$(call meta-vc11sln-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst \ +$(src_root),,$(src_base)),$(if $3,$3,-vc11.vcxproj),$4,$5,$6,$7,$8,$9) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4 - project suffix +# $4-10 - additional varibales +# +$(out_base)/%: meta-vc11sln-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $5,$5='$6'; export $5; )$(if \ +$7,$7='$8'; export $7; )$(if $9,$9='$(10)'; export $9; )$(bld_root)/meta/vcsln \ +-v 11 -b $(dist_prefix)$3 -e '$4' -o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc11sln.make b/build-0.3/meta/vc11sln.make new file mode 100644 index 0000000..8a212fe --- /dev/null +++ b/build-0.3/meta/vc11sln.make @@ -0,0 +1,5 @@ +# file : build/meta/vc11sln.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc11sln-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc12proj-functions.make b/build-0.3/meta/vc12proj-functions.make new file mode 100644 index 0000000..bee0cda --- /dev/null +++ b/build-0.3/meta/vc12proj-functions.make @@ -0,0 +1,27 @@ +# file : build/meta/vc12proj-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ project file template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3-8 - optional pairs of additional varibales and values $3=$4, $5=$6, etc +# +# +$(out_base)/%: meta-vc12proj = \ +$(call meta-vc12proj-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst $(src_root),,$(src_base)),$3,$4,$5,$6,$7,$8) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4-9 - additional varibales +# +$(out_base)/%: meta-vc12proj-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $4,$4='$5'; export $4; )$(if \ +$6,$6='$7'; export $6; )$(if $8,$8='$9'; export $8; )$(bld_root)/meta/vc10proj \ +-o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc12proj.make b/build-0.3/meta/vc12proj.make new file mode 100644 index 0000000..7ac3a9a --- /dev/null +++ b/build-0.3/meta/vc12proj.make @@ -0,0 +1,5 @@ +# file : build/meta/vc12proj.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc12proj-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc12sln-functions.make b/build-0.3/meta/vc12sln-functions.make new file mode 100644 index 0000000..3900c01 --- /dev/null +++ b/build-0.3/meta/vc12sln-functions.make @@ -0,0 +1,29 @@ +# file : build/meta/vc12sln-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ solution template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3 - project suffix (-vc12.vcxproj by default) +# $4-9 - optional pairs of additional varibales and values $4=$5, $6=$7, etc +# +$(out_base)/%: meta-vc12sln = \ +$(call meta-vc12sln-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst \ +$(src_root),,$(src_base)),$(if $3,$3,-vc12.vcxproj),$4,$5,$6,$7,$8,$9) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4 - project suffix +# $4-10 - additional varibales +# +$(out_base)/%: meta-vc12sln-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $5,$5='$6'; export $5; )$(if \ +$7,$7='$8'; export $7; )$(if $9,$9='$(10)'; export $9; )$(bld_root)/meta/vcsln \ +-v 12 -b $(dist_prefix)$3 -e '$4' -o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc12sln.make b/build-0.3/meta/vc12sln.make new file mode 100644 index 0000000..9e61b93 --- /dev/null +++ b/build-0.3/meta/vc12sln.make @@ -0,0 +1,5 @@ +# file : build/meta/vc12sln.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc12sln-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc8proj-functions.make b/build-0.3/meta/vc8proj-functions.make new file mode 100644 index 0000000..695405c --- /dev/null +++ b/build-0.3/meta/vc8proj-functions.make @@ -0,0 +1,27 @@ +# file : build/meta/vc8proj-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ project file template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3-8 - optional pairs of additional varibales and values $3=$4, $5=$6, etc +# +# +$(out_base)/%: meta-vc8proj = \ +$(call meta-vc8proj-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst $(src_root),,$(src_base)),$3,$4,$5,$6,$7,$8) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4-9 - additional varibales +# +$(out_base)/%: meta-vc8proj-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $4,$4='$5'; export $4; )$(if \ +$6,$6='$7'; export $6; )$(if $8,$8='$9'; export $8; )$(bld_root)/meta/vc9proj \ +-o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc8proj.make b/build-0.3/meta/vc8proj.make new file mode 100644 index 0000000..179db17 --- /dev/null +++ b/build-0.3/meta/vc8proj.make @@ -0,0 +1,5 @@ +# file : build/meta/vc8proj.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc8proj-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc8sln-functions.make b/build-0.3/meta/vc8sln-functions.make new file mode 100644 index 0000000..0391a1c --- /dev/null +++ b/build-0.3/meta/vc8sln-functions.make @@ -0,0 +1,29 @@ +# file : build/meta/vc8sln-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ 8 solution template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3 - project suffix (-vc8.vcproj by default) +# $4-9 - optional pairs of additional varibales and values $4=$5, $6=$7, etc +# +$(out_base)/%: meta-vc8sln = \ +$(call meta-vc8sln-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst \ +$(src_root),,$(src_base)),$(if $3,$3,-vc8.vcproj),$4,$5,$6,$7,$8,$9) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4 - project suffix +# $4-10 - additional varibales +# +$(out_base)/%: meta-vc8sln-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $5,$5='$6'; export $5; )$(if \ +$7,$7='$8'; export $7; )$(if $9,$9='$(10)'; export $9; )$(bld_root)/meta/vcsln \ +-v 8 -b $(dist_prefix)$3 -e '$4' -o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc8sln.make b/build-0.3/meta/vc8sln.make new file mode 100644 index 0000000..70e0703 --- /dev/null +++ b/build-0.3/meta/vc8sln.make @@ -0,0 +1,5 @@ +# file : build/meta/vc8sln.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc8sln-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc9proj b/build-0.3/meta/vc9proj new file mode 100755 index 0000000..03130b4 --- /dev/null +++ b/build-0.3/meta/vc9proj @@ -0,0 +1,75 @@ +#! /usr/bin/env bash + +# file : build/meta/vc9proj +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ 9 project file templates. +# +# Options: +# +# -o <output-file> +# +# Arguments: +# +# <template-file> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +output= + +while [ $# -gt 0 ]; do + case $1 in + -o) + output=$2 + shift 2 + ;; + *) + break + ;; + esac +done + +input=$1 + +if [ "$input" = "" ]; then + error "no input file" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +m4=m4 +u2d=todos + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + + +# Determine available configurations. +# +conf=`sed -n -e \ +'/^[ ]*<Configuration$/{n;s/[ ]*Name="\([^"]*\)"$/"\1",/p};d' $input` +conf=`echo $conf | sed -e 's/,$//'` + +export configurations=$conf + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/vc9proj.m4 $input >$output +$u2d $output +chmod 644 $output diff --git a/build-0.3/meta/vc9proj-functions.make b/build-0.3/meta/vc9proj-functions.make new file mode 100644 index 0000000..987cff7 --- /dev/null +++ b/build-0.3/meta/vc9proj-functions.make @@ -0,0 +1,27 @@ +# file : build/meta/vc9proj-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ project file template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3-8 - optional pairs of additional varibales and values $3=$4, $5=$6, etc +# +# +$(out_base)/%: meta-vc9proj = \ +$(call meta-vc9proj-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst $(src_root),,$(src_base)),$3,$4,$5,$6,$7,$8) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4-9 - additional varibales +# +$(out_base)/%: meta-vc9proj-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $4,$4='$5'; export $4; )$(if \ +$6,$6='$7'; export $6; )$(if $8,$8='$9'; export $8; )$(bld_root)/meta/vc9proj \ +-o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc9proj.m4 b/build-0.3/meta/vc9proj.m4 new file mode 100644 index 0000000..e8d56b4 --- /dev/null +++ b/build-0.3/meta/vc9proj.m4 @@ -0,0 +1,103 @@ +m4_divert(-1) +# file : build/meta/vc9proj.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_changequote([, ]) + +m4_include(__meta_base__[/common.m4]) +m4_include(__meta_base__[/windows-common.m4]) + +# file +# +m4_define([__file_entry_impl__],[ + <File + RelativePath=".\[$1]" + > + </File>]) + +m4_define([__file_entry__], +[m4_equote()__file_entry_impl__([$1])[]m4_dquote()]) + + +m4_define([__file_entries_impl__], +[m4_foreach_w([__f], __path_impl__([$1]), [__file_entry_impl__(__f)])]) + +m4_define([__file_entries__], +[m4_equote()__file_entries_impl__([$1])[]m4_dquote()]) + +# file_custom_build +# +m4_define([__custom_build_entry_impl__],[ + <FileConfiguration + Name=[$1] + > + <Tool + Name="VCCustomBuildTool" + Description="[$2]" + CommandLine="[$3]"m4_ifelse([$5], [], [], [ + AdditionalDependencies="$5"]) + Outputs="[$4]" + /> + </FileConfiguration>]) + +m4_define([__file_entry_custom_build_impl__],[ + <File + RelativePath=".\[$1]" + >m4_dnl +m4_foreach([__c], +[__value_impl__([configurations])], +[__custom_build_entry_impl__(__c, [$2], [$3], [$4], [$5])]) + </File>]) + +# (file, cmd-description, cmd, output;output[, add-dep;add-dep]) +# +m4_define([__file_entry_custom_build__], +[m4_equote()__file_entry_custom_build_impl__([$1], +[$2], [$3], [$4], [$5])[]m4_dquote()]) + + +# source +# + +# $1 - configuration +# $2 - directory +# +m4_define([__source_config_entry_impl__],[ + <FileConfiguration + Name=[$1] + > + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)\[$2]\" + /> + </FileConfiguration>]) + +m4_define([__source_config_impl__], +[m4_ifelse([$1], [$2], [], +[m4_foreach([__c], +[__value_impl__([configurations])], +[__source_config_entry_impl__(__c, [$1])])])]) + +m4_define([__source_entry_impl__],[ + <File + RelativePath=".\[$1]" + >m4_dnl +__source_config_impl__(m4_patsubst([$1], [^\(.*\)\\\(.*\)$], [\1]), [$1]) + </File>]) + +m4_define([__source_entry__], +[m4_equote()__source_entry_impl__([$1])[]m4_dquote()]) + +m4_define([__source_entries_impl__], +[m4_foreach_w([__f], __path_impl__([$1]), [__source_entry_impl__(__f)])]) + +m4_define([__source_entries__], +[m4_equote()__source_entries_impl__([$1])[]m4_dquote()]) + +# Disable comments and quoting. +# +m4_changecom([]) +m4_changequote([]) + +m4_divert(0)m4_dnl diff --git a/build-0.3/meta/vc9proj.make b/build-0.3/meta/vc9proj.make new file mode 100644 index 0000000..03eb2c5 --- /dev/null +++ b/build-0.3/meta/vc9proj.make @@ -0,0 +1,5 @@ +# file : build/meta/vc9proj.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc9proj-functions.make,$(out_base)) diff --git a/build-0.3/meta/vc9sln-functions.make b/build-0.3/meta/vc9sln-functions.make new file mode 100644 index 0000000..07b03c3 --- /dev/null +++ b/build-0.3/meta/vc9sln-functions.make @@ -0,0 +1,29 @@ +# file : build/meta/vc9sln-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ 9 solution template and write output to $(dist_prefix)/<path>. +# Where path is computed as difference between src_base and src_root. +# +# Arguments: +# +# $1 - template path, if doesn't start with /, assume relative to src_base +# $2 - output name (optional) +# $3 - project suffix (-vc9.vcproj by default) +# $4-9 - optional pairs of additional varibales and values $4=$5, $6=$7, etc +# +$(out_base)/%: meta-vc9sln = \ +$(call meta-vc9sln-body,$(if $(filter /%,$1),$1,$(src_base)/$1),$(if \ +$2,$2,$(notdir $1)),$(subst \ +$(src_root),,$(src_base)),$(if $3,$3,-vc9.vcproj),$4,$5,$6,$7,$8,$9) + +# $1 - template +# $2 - output name +# $3 - difference between src_base and src_root with leading '\' +# $4 - project suffix +# $4-10 - additional varibales +# +$(out_base)/%: meta-vc9sln-body = \ +$(call message,meta $(dist_prefix)$3/$2,$(if $5,$5='$6'; export $5; )$(if \ +$7,$7='$8'; export $7; )$(if $9,$9='$(10)'; export $9; )$(bld_root)/meta/vcsln \ +-v 9 -b $(dist_prefix)$3 -e '$4' -o $(dist_prefix)$3/$2 $1) diff --git a/build-0.3/meta/vc9sln.make b/build-0.3/meta/vc9sln.make new file mode 100644 index 0000000..50c6b7b --- /dev/null +++ b/build-0.3/meta/vc9sln.make @@ -0,0 +1,5 @@ +# file : build/meta/vc9sln.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vc9sln-functions.make,$(out_base)) diff --git a/build-0.3/meta/vcsln b/build-0.3/meta/vcsln new file mode 100755 index 0000000..99aaf47 --- /dev/null +++ b/build-0.3/meta/vcsln @@ -0,0 +1,181 @@ +#! /usr/bin/env bash + +# file : build/meta/vcsln +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ solution templates. +# +# Options: +# +# -b <base-dir> +# -o <output-file> +# -e <project-ext> +# -v <vc-version> {8, 9, 10, 11, 12} +# +# Arguments: +# +# <template-file> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +base= +output= +projext= +vcver= + +while [ $# -gt 0 ]; do + case $1 in + -b) + base=$2 + shift 2 + ;; + -o) + output=$2 + shift 2 + ;; + -e) + projext=$2 + shift 2 + ;; + -v) + vcver=$2 + shift 2 + ;; + *) + break + ;; + esac +done + +input=$1 + +if [ "$input" = "" ]; then + error "no input file" + exit 1 +fi + +if [ "$base" = "" ]; then + error "no base directory" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +if [ "$projext" = "" ]; then + error "no VC++ project file extension" + exit 1 +fi + +if [ "$vcver" = "" ]; then + error "no VC++ version" + exit 1 +fi + +m4=m4 +u2d=todos + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + +# Find all the project files. +# +all_proj_files=`find $base -name '*'$projext` + +# Filter out subdirectories which already have solution files. +# +proj_files= +proj_names= +for f in $all_proj_files; do + n=`echo "$f" | sed -e "s%^$base/\(.*\)/.*$%\1%"` + + # If there is no sub-directory for this project, then use the + # root directory name. + # + if [ "$n" = "$f" ]; then + n=`basename $base` + d="." + else + d=$n + fi + + while [ "$d" != "." ]; do + if ls $base/$d/*.sln >/dev/null 2>&1; then + break + fi + d=`dirname $d` + done + + # If we din't find any solutions, then add this file to the list. + # + if [ "$d" = "." ]; then + proj_names="$proj_names $n" + proj_files="$proj_files $f" + fi +done + +# Determine available configurations and project uuids. +# +conf= +proj_uuids= +for f in $proj_files; do + + if [ "$conf" = "" ]; then + if [ "$vcver" = "8" -o "$vcver" = "9" ]; then + conf=`cat $f | fromdos | sed -n -e \ + '/^[ ]*<Configuration$/{n;s/[ ]*Name="\([^"]*\)"$/"\1",/p};d' -` + conf=`echo $conf | sed -e 's/,$//'` + else + conf=`cat $f | fromdos | sed -n -e \ + 's/^[ ]*<ProjectConfiguration Include="\([^"]*\)">$/"\1",/p;d' -` + conf=`echo $conf | sed -e 's/,$//'` + fi + fi + + if [ "$vcver" = "8" -o "$vcver" = "9" ]; then + uuid=`cat $f | fromdos | sed -n -e \ + 's/^[ ]*ProjectGUID="{\([^}]*\)}"$/\1/p;d'` + else + uuid=`cat $f | fromdos | sed -n -e \ + 's/^[ ]*<ProjectGuid>{\([^}]*\)}<\/ProjectGuid>$/\1/p;d'` + fi + + if [ "$proj_uuids" = "" ]; then + proj_uuids=$uuid + else + proj_uuids="$proj_uuids $uuid" + fi +done + +proj_files=`echo $proj_files | sed -e "s%$base/%%g"` +proj_names=`echo $proj_names | sed -e "s%/%-%g"` + +#error $proj_files +#error $proj_names +#error $proj_uuids +#error $conf + +export configurations=$conf +export project_files=$proj_files +export project_names=$proj_names +export project_uuids=$proj_uuids + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/vcsln.m4 $input >$output +$u2d $output +chmod 644 $output diff --git a/build-0.3/meta/vcsln.m4 b/build-0.3/meta/vcsln.m4 new file mode 100644 index 0000000..2299bac --- /dev/null +++ b/build-0.3/meta/vcsln.m4 @@ -0,0 +1,82 @@ +m4_divert(-1) +# file : build/meta/vcsln.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_changequote([, ]) + +m4_include(__meta_base__[/common.m4]) +m4_include(__meta_base__[/windows-common.m4]) + +# solution_configuration +# +m4_define([__solution_configuration_entry_impl__], [ [$1] = [$1]]) + +m4_define([__solution_configurations_impl__], + [m4_foreach([__c], + [__value_impl__([configurations])], + [__solution_configuration_entry_impl__(m4_patsubst(__c, ["], [])) +])]) + +m4_define([__solution_configurations__], + [m4_equote()__solution_configurations_impl__()[]m4_dquote()]) + +# project_configuration +# +m4_define([__project_configuration_entry_item_impl__], +[ {[$1]}.[$2].ActiveCfg = [$2] + {[$1]}.[$2].Build.0 = [$2]]) + +m4_define([__project_configuration_entry_impl__], + [m4_foreach( + [__c], + [__value_impl__([configurations])], + [__project_configuration_entry_item_impl__([$1], m4_patsubst(__c, ["], [])) +])]) + +m4_define([__project_configurations_impl__], + [m4_foreach_w( + [__u], + [__value_impl__([project_uuids])], + [__project_configuration_entry_impl__(__u)])]) + +m4_define([__project_configurations__], + [m4_equote()__project_configurations_impl__()[]m4_dquote()]) + +# project_entry(name, file, uuid) +# +m4_define([__project_entry_impl__], +[Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "[$1]", "[$2]", "{[$3]}" +EndProject]) + +m4_define([__project_entry__], + [m4_equote()__project_entry_impl__([$1], [$2], [$3])[]m4_dquote()]) + +# projects +# +m4_define([__project_step_impl__], +[__project_entry_impl__( + m4_substr([$1], 0, m4_ifelse(m4_index([$1], [ ]), [-1], [m4_len([$1])], [m4_index([$1], [ ])])), + m4_substr([$2], 0, m4_ifelse(m4_index([$2], [ ]), [-1], [m4_len([$2])], [m4_index([$2], [ ])])), + m4_substr([$3], 0, m4_ifelse(m4_index([$3], [ ]), [-1], [m4_len([$3])], [m4_index([$3], [ ])])))[]m4_dnl +m4_ifelse(m4_index([$1], [ ]), [-1],, [ +__project_step_impl__( + m4_substr([$1], m4_incr(m4_index([$1], [ ]))), + m4_substr([$2], m4_incr(m4_index([$2], [ ]))), + m4_substr([$3], m4_incr(m4_index([$3], [ ]))))])]) + +m4_define([__projects_impl__], +[__project_step_impl__( + __value_impl__([project_names]), + __path_impl__([project_files]), + __value_impl__([project_uuids]))]) + +m4_define([__projects__], + [m4_equote()__projects_impl__()[]m4_dquote()]) + +# Disable comments and quoting. +# +m4_changecom([]) +m4_changequote([]) + +m4_divert(0)m4_dnl diff --git a/build-0.3/meta/vctest b/build-0.3/meta/vctest new file mode 100755 index 0000000..0502364 --- /dev/null +++ b/build-0.3/meta/vctest @@ -0,0 +1,143 @@ +#! /usr/bin/env bash + +# file : build/meta/vctest +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ test templates. +# +# Options: +# +# -b <base-dir> +# -r <root-dir> +# -o <output-file> +# -t <template-file> +# +# Arguments: +# +# <solution-files> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +base= +root= +output= +sln= +input= + +while [ $# -gt 0 ]; do + case $1 in + -b) + base=$2 + shift 2 + ;; + -r) + root=$2 + shift 2 + ;; + -o) + output=$2 + shift 2 + ;; + -t) + input=$2 + shift 2 + ;; + *) + sln="$sln $1" + shift + ;; + esac +done + + +if [ "$input" = "" ]; then + error "no template file" + exit 1 +fi + +if [ "$base" = "" ]; then + error "no base directory" + exit 1 +fi + +if [ "$root" = "" ]; then + error "no root directory" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +if [ "$sln" = "" ]; then + error "no solution file" + exit 1 +fi + + +m4=m4 +u2d=todos + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + +# Figure out topdir +# +if [ "$base" = "$root" ]; then + topdir=. +else + topdir=`echo $base | sed -e "s%^$root/%%" - | \ +sed -e 's%[^/][^/]*/%../%g;s%[^./][^./]*$%..%' -` +fi + +# + +# Determine possible configurations. +# +for f in $sln; do + sln_conf=`cat $f | fromdos | sed -n -e \ +'/^[ ]*GlobalSection(SolutionConfigurationPlatforms).*$/{\ +: loop;\ +n;\ +/^[ ]*EndGlobalSection$/q;\ +s/^[ ]*\([^=]*\) = \([^=]*\)$/\1/p;\ +b loop};\ +d' -` + break +done + +confs= +plats= +for c in $sln_conf; do + conf=`echo $c | sed -e 's/^\(.*\)|.*$/\1/'` + plat=`echo $c | sed -e 's/^.*|\(.*\)$/\1/'` + + confs="$confs $conf" + plats="$plats $plat" +done + +confs=`echo $confs | sed -e 's/ /\n/g' - | sort -u` +plats=`echo $plats | sed -e 's/ /\n/g' - | sort -u` + +export topdir +export configurations=$confs +export platforms=$plats + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/vctest.m4 $input >$output +$u2d $output +chmod 644 $output diff --git a/build-0.3/meta/vctest-functions.make b/build-0.3/meta/vctest-functions.make new file mode 100644 index 0000000..e67945b --- /dev/null +++ b/build-0.3/meta/vctest-functions.make @@ -0,0 +1,28 @@ +# file : build/meta/vctest-functions.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process VC++ solution and test template and write output to +# $(dist_prefix)/<path>. Where path is computed as difference +# between src_base and src_root. +# +# Arguments: +# +# $1 - solution path, if doens't start with /, assume relative to +# dist_prefix/<path> +# $2 - template path, if doesn't start with /, assume relative to src_base +# $3 - output name (optional) +# +$(out_base)/%: meta-vctest = \ +$(call meta-vctest-body,$1,$(if $(filter /%,$2),$2,$(src_base)/$2),$(if \ +$3,$3,$(notdir $2)),$(subst $(src_root),,$(src_base))) + +# $1 - solution +# $2 - template +# $3 - output name +# $4 - difference between src_base and src_root with leading '\' +# +$(out_base)/%: meta-vctest-body = \ +$(call message,meta $(dist_prefix)$4/$3,$(bld_root)/meta/vctest \ +-r $(dist_prefix) -b $(dist_prefix)$4 -t $2 -o $(dist_prefix)$4/$3 \ +$(if $(filter /%,$1),$1,$(dist_prefix)$4/$1)) diff --git a/build-0.3/meta/vctest.m4 b/build-0.3/meta/vctest.m4 new file mode 100644 index 0000000..724a0fc --- /dev/null +++ b/build-0.3/meta/vctest.m4 @@ -0,0 +1,17 @@ +m4_divert(-1) +# file : build/meta/vctest.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_changequote([, ]) + +m4_include(__meta_base__[/common.m4]) +m4_include(__meta_base__[/windows-common.m4]) + + +# Disable comments and quoting. +# +m4_changecom([]) +m4_changequote([]) + +m4_divert(0)m4_dnl diff --git a/build-0.3/meta/vctest.make b/build-0.3/meta/vctest.make new file mode 100644 index 0000000..1cf336c --- /dev/null +++ b/build-0.3/meta/vctest.make @@ -0,0 +1,5 @@ +# file : build/meta/vctest.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(bld_root)/meta/vctest-functions.make,$(out_base)) diff --git a/build-0.3/meta/windows-common.m4 b/build-0.3/meta/windows-common.m4 new file mode 100644 index 0000000..700f8e8 --- /dev/null +++ b/build-0.3/meta/windows-common.m4 @@ -0,0 +1,49 @@ +# file : build/meta/windows-common.m4 +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +m4_define([__path_impl__], [m4_translit(__env_impl__([$1]),[/],[\])]) +m4_define([__path__], [m4_equote()__path_impl__([$1])[]m4_dquote()]) + +m4_define([__file_impl__], [__env_impl__([$1])]) +m4_define([__file__], [m4_equote()__file_impl__([$1])[]m4_dquote()]) + +# Convert POSIX shell quoting to Windows. Arguments that are in +# single quotes (') are converted to double quotes ("). Double +# quotes that are nested in single quotes are converted to \". +# Quote escaping is not recognized. Single-quoted arguments +# should be quoted as a whole, for example 'foo-bar' and not +# foo-'bar'. +# + +m4_define([__shell_quotes_convert_impl__], [m4_patsubst([$1], ["], [\\"])]) + +# $1 string without the opening quote +# $2 index of the closing quote +# +m4_define([__shell_quotes_in_quote_impl__], +["__shell_quotes_convert_impl__(m4_substr([$1], [0], [$2]))"[]m4_dnl + __shell_quotes_impl__(m4_substr([$1], m4_incr([$2])))]) + +# $1 string without the leading space +# $2 index of the next space or -1 +# +m4_define([__shell_quotes_in_space_impl__], +[m4_substr([$1], [0], m4_ifelse([$2], [-1], [m4_len([$1])], [$2]))[]m4_dnl +m4_ifelse( + [$2], [-1], + [], + [ __shell_quotes_impl__(m4_substr([$1], m4_incr([$2])))])]) + +# +# +m4_define([__shell_quotes_impl__], +[m4_ifelse( + m4_index([$1], [']), [0], + [__shell_quotes_in_quote_impl__( + m4_substr([$1], [1]), + m4_index(m4_substr([$1], [1]), [']))], + [__shell_quotes_in_space_impl__([$1], m4_index([$1], [ ]))])]) + +m4_define([__shell_quotes__], +[m4_equote()__shell_quotes_impl__([$1])[]m4_dquote()]) diff --git a/build-0.3/run-if-arg b/build-0.3/run-if-arg index 819a3cb..1076b46 100755 --- a/build-0.3/run-if-arg +++ b/build-0.3/run-if-arg @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/run-if-arg -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # Run command if there are any non-empty arguments. diff --git a/build-0.3/system.make b/build-0.3/system.make index 7de97db..3a9c051 100644 --- a/build-0.3/system.make +++ b/build-0.3/system.make @@ -1,6 +1,5 @@ # file : build/system.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file $(call include-once,$(bld_root)/system/configuration-rules.make,$(dcf_root)) diff --git a/build-0.3/system/configuration-rules.make b/build-0.3/system/configuration-rules.make index b1aa605..3af4514 100644 --- a/build-0.3/system/configuration-rules.make +++ b/build-0.3/system/configuration-rules.make @@ -1,6 +1,5 @@ # file : build/system/configuration-rules.make -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file @@ -11,14 +10,13 @@ ifeq ($(.DEFAULT_GOAL),$(dcf_root)/system/configuration-dynamic.make) .DEFAULT_GOAL := endif - ifndef %foreign% -disfigure:: +$(dcf_root)/.disfigure:: $(call message,rm $(dcf_root)/system/configuration-dynamic.make,\ rm -f $(dcf_root)/system/configuration-dynamic.make) -ifeq ($(.DEFAULT_GOAL),disfigure) +ifeq ($(.DEFAULT_GOAL),$(dcf_root)/.disfigure) .DEFAULT_GOAL := endif diff --git a/build-0.3/system/configure b/build-0.3/system/configure index 621a12a..3c1b968 100755 --- a/build-0.3/system/configure +++ b/build-0.3/system/configure @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/system/configure -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file # $1 out file |