diff options
Diffstat (limited to 'build-0.3/c/gnu')
-rw-r--r-- | build-0.3/c/gnu/c-d.make | 58 | ||||
-rw-r--r-- | build-0.3/c/gnu/c-o.make | 41 | ||||
-rw-r--r-- | build-0.3/c/gnu/configuration-rules.make | 15 | ||||
-rw-r--r-- | build-0.3/c/gnu/configuration-static.make | 3 | ||||
-rw-r--r-- | build-0.3/c/gnu/configuration.make | 33 | ||||
-rwxr-xr-x | build-0.3/c/gnu/configure | 85 | ||||
-rwxr-xr-x | build-0.3/c/gnu/dep | 57 | ||||
-rw-r--r-- | build-0.3/c/gnu/o-e.make | 39 | ||||
-rw-r--r-- | build-0.3/c/gnu/o-l.make | 92 |
9 files changed, 423 insertions, 0 deletions
diff --git a/build-0.3/c/gnu/c-d.make b/build-0.3/c/gnu/c-d.make new file mode 100644 index 0000000..bc7411f --- /dev/null +++ b/build-0.3/c/gnu/c-d.make @@ -0,0 +1,58 @@ +# file : build/c/gnu/c-o.make +# 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)) +$(call include,$(bld_root)/c/gnu/configuration.make) + +# Make will try to build dependecies (since they are ultimately included +# files) during configuartion phase without c_gnu being discovered yet. +# This is also why dependecies should be included with -include. +# +ifdef c_gnu + +$(out_base)/%.o.d: c := $(c_gnu) +$(out_base)/%.o.d: cpp_options ?= + +#@@ This needs to be shared with c-o. +# +#@@ wrong prefix +# +$(out_base)/%.o.d: expand-cpp-options-impl = \ +$(if $1,$(shell sed -e 's%include: \(.*\)%\1%' -e t -e d $1)) + +$(out_base)/%.o.d: expand-cpp-options = \ +$(call expand-cpp-options-impl,$(filter %.cpp-options,$1)) + +.PRECIOUS: $(out_base)/%.o.d + +ifeq ($(out_base),$(src_base)) +$(out_base)/%.o.d: $(src_base)/%.$(c_s_suffix) +else +$(out_base)/%.o.d: $(src_base)/%.$(c_s_suffix) | $$(dir $$@). +endif + $(call message,,if test -f $@; then mv $@ $@.old; fi && \ +$(c) $(cpp_options) $(call expand-cpp-options,$^) $(c_pp_extra_options) \ +$(c_extra_options) -M -MG -MP -MQ $@ -MQ $(basename $@) $< | \ +$(bld_root)/c/gnu/dep $(out_base) $(filter %.cpp-options,$^) >$@ && \ +if test -f $@.old; then if cmp -s $@ $@.old; then rm -f $@.old && false; \ +else rm -f $@.old && true; fi fi) + +ifneq ($(out_base),$(src_base)) + +$(out_base)/%.o.d: $(out_base)/%.$(c_s_suffix) | $$(dir $$@). + $(call message,,if test -f $@; then mv $@ $@.old; fi && \ +$(c) $(cpp_options) $(call expand-cpp-options,$^) $(c_pp_extra_options) \ +$(c_extra_options) -M -MG -MP -MQ $@ -MQ $(basename $@) $< | \ +$(bld_root)/c/gnu/dep $(out_base) $(filter %.cpp-options,$^) >$@ && \ +if test -f $@.old; then if cmp -s $@ $@.old; then rm -f $@.old && false; \ +else rm -f $@.old && true; fi fi) + +endif + +.PHONY: $(out_base)/%.o.d.$(c_s_suffix).clean + +$(out_base)/%.o.d.$(c_s_suffix).clean: + $(call message,rm $$1,rm -f $$1,$(basename $(basename $@))) + +endif diff --git a/build-0.3/c/gnu/c-o.make b/build-0.3/c/gnu/c-o.make new file mode 100644 index 0000000..46eb1da --- /dev/null +++ b/build-0.3/c/gnu/c-o.make @@ -0,0 +1,41 @@ +# file : build/c/gnu/c-o.make +# 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)) +$(call include,$(bld_root)/c/gnu/configuration.make) + +$(out_base)/%.o: c := $(c_gnu) +$(out_base)/%.o: c_options := $(c_gnu_optimization_options) $(c_gnu_debugging_options) + +#@@ wrong prefix +# +$(out_base)/%.o: expand-cpp-options-impl = \ +$(if $1,$(shell sed -e 's%include: \(.*\)%\1%' -e t -e d $1)) + +$(out_base)/%.o: expand-cpp-options = \ +$(call expand-cpp-options-impl,$(filter %.cpp-options,$1)) + +ifeq ($(out_base),$(src_base)) +$(out_base)/%.o: $(src_base)/%.$(c_s_suffix) +else +$(out_base)/%.o: $(src_base)/%.$(c_s_suffix) | $$(dir $$@). +endif + $(call message,c $<,$(c) \ +$(cpp_options) $(call expand-cpp-options,$^) $(c_pp_extra_options) $(c_options) \ +$(c_pic_options) $(subst y,-fexceptions,$(filter y,$(c_exceptions))) $(c_extra_options) -o $@ -c $<) + + +ifneq ($(out_base),$(src_base)) + +$(out_base)/%.o: $(out_base)/%.$(c_s_suffix) | $$(dir $$@). + $(call message,c $<,$(c) \ +$(cpp_options) $(call expand-cpp-options,$^) $(c_pp_extra_options) $(c_options) \ +$(c_pic_options) $(subst y,-fexceptions,$(filter y,$(c_exceptions))) $(c_extra_options) -o $@ -c $<) + +endif + +.PHONY: $(out_base)/%.o.$(c_s_suffix).clean + +$(out_base)/%.o.$(c_s_suffix).clean: + $(call message,rm $$1,rm -f $$1,$(basename $(basename $@))) diff --git a/build-0.3/c/gnu/configuration-rules.make b/build-0.3/c/gnu/configuration-rules.make new file mode 100644 index 0000000..cb25dfe --- /dev/null +++ b/build-0.3/c/gnu/configuration-rules.make @@ -0,0 +1,15 @@ +# file : build/c/gnu/configuration-rules.make +# 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) \ +"$(c_extra_options)" "$(c_ld_extra_options)") + +ifndef %foreign% + +$(dcf_root)/.disfigure:: + $(call message,rm $(dcf_root)/c/gnu/configuration-dynamic.make,\ +rm -f $(dcf_root)/c/gnu/configuration-dynamic.make) + +endif diff --git a/build-0.3/c/gnu/configuration-static.make b/build-0.3/c/gnu/configuration-static.make new file mode 100644 index 0000000..e9be2b9 --- /dev/null +++ b/build-0.3/c/gnu/configuration-static.make @@ -0,0 +1,3 @@ +# file : build/c/gnu/configuration-static.make +# 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 new file mode 100644 index 0000000..32aaf97 --- /dev/null +++ b/build-0.3/c/gnu/configuration.make @@ -0,0 +1,33 @@ +# file : build/c/gnu/configuration.make +# 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)) + +# Static configuration. +# +$(call include,$(bld_root)/c/gnu/configuration-static.make) + +ifneq ($(bld_root),$(scf_root)) +$(call -include,$(scf_root)/c/gnu/configuration-static.make) +endif + +# Dynamic configuration. +# +c_gnu := +c_gnu_optimization_options := + +$(call -include,$(dcf_root)/c/gnu/configuration-dynamic.make) + +ifdef c_gnu + +c_gnu_debugging_options := $(if $(findstring y,$(c_debug)),-g) + +$(out_root)/%: c_gnu_debugging_options := $(c_gnu_debugging_options) +$(out_root)/%: c_gnu_optimization_options := $(c_gnu_optimization_options) + +else + +.NOTPARALLEL: + +endif diff --git a/build-0.3/c/gnu/configure b/build-0.3/c/gnu/configure new file mode 100755 index 0000000..713f091 --- /dev/null +++ b/build-0.3/c/gnu/configure @@ -0,0 +1,85 @@ +#! /usr/bin/env bash + +# file : build/c/gnu/configure +# 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 +# + + +source $bld_root/dialog.bash + +$echo +$echo +$echo "configuring '$project_name'" +$echo +$echo + +$echo +$echo "Please enter the gcc binary you would like to use, for example 'gcc-3.4'," +$echo "'/usr/local/bin/gcc' or 'distcc gcc'." +$echo + +c_gnu=`read_path --command gcc` + +# 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= + +if [ "$2" == "y" ]; then + + $echo + $echo "Please select the optimization level you would like to use:" + $echo + $echo "(1) -O1 [Tries to reduce code size and execution time, without" + $echo " performing any optimizations that take a great deal of" + $echo " compilation time.]" + $echo "(2) -O2 [Performs nearly all supported optimizations that do not" + $echo " involve a space-speed tradeoff.]" + $echo "(3) -O3 [Optimize even more.]" + $echo "(4) -Os [Optimize for size.]" + $echo + + optimization=`read_option "-O1 -O2 -O3 -Os" "-O2"` + +fi + +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 new file mode 100755 index 0000000..ecafcb1 --- /dev/null +++ b/build-0.3/c/gnu/dep @@ -0,0 +1,57 @@ +#! /usr/bin/env bash + +# file : build/c/gnu/dep +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Post-process generated dependency information. +# +# $1 current project's $(out_base) +# $2 - $N optional .cpp-options files + +out_base=$1 +shift + +files=$* + +#echo $out_base +#echo $files + +script= + +function gen_script () +{ + while [ "$1" ]; do + prefix=$1 + shift + + path=$1 + shift + + # Besides unresolved paths also replace default installation + # targets (/usr/include and /usr/local/include). + # + script="$script"\ +"s \\ $prefix \\ $path$prefix g;"\ +"s \\ /usr/include/$prefix \\ $path$prefix g;"\ +"s \\ /usr/local/include/$prefix \\ $path$prefix g;"\ +"s ^$prefix $path$prefix ;"\ +"s ^/usr/include/$prefix $path$prefix ;"\ +"s ^/usr/local/include/$prefix $path$prefix ;" + done +} + +if [ "$files" ]; then + prefixes=`sed -e 's%^prefix: \(.*\)$%\1%' -e t -e d $files` + gen_script $prefixes +fi + +# The last part of the script translates all file names that don't start +# with / or . (that is, local generated files) to files in $out_base. Note +# that it is assumed that such files are never installed and therefore there +# is no way to get around the situation where this file is picket up from +# some other place (e.g., /usr/include). +# +epilogue="s% \([^/. \\\\]\)% $out_base/\1%g;s%^\([^/. ].*:\)%$out_base/\1%" + +exec sed -e "$script$epilogue" diff --git a/build-0.3/c/gnu/o-e.make b/build-0.3/c/gnu/o-e.make new file mode 100644 index 0000000..a54a9f3 --- /dev/null +++ b/build-0.3/c/gnu/o-e.make @@ -0,0 +1,39 @@ +# file : build/c/gnu/o-e.make +# 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) + +#@@ should it be lib%.so? +# +ifneq ($(c_extra_lib_paths),) +vpath %.so $(c_extra_lib_paths) +vpath %.a $(c_extra_lib_paths) +endif + +ifneq ($(c_gnu_libraries),) +vpath %.so $(c_gnu_libraries) +vpath %.a $(c_gnu_libraries) +endif + +$(out_base)/%: ld := $(c_gnu) +$(out_base)/%: ld_options := $(c_gnu_optimization_options) $(c_gnu_debugging_options) $(c_ld_extra_options) + +$(out_base)/%: expand-l = $(if $(subst n,,$(c_rpath)),\ +$(shell sed -e 's%^rpath:\(.*\)%-Wl,-rpath,\1%' $1),\ +$(shell sed -e 's%^rpath:\(.*\)%%' $1)) + +ifeq ($(out_base),$(src_base)) +$(out_base)/%: $(out_base)/%.o +else +$(out_base)/%: $(out_base)/%.o | $$(dir $$@). +endif + $(call message,ld $@,$(ld) \ +$(c_extra_options) $(ld_options) $(c_ld_extra_options) -o $@ \ +$(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(c_extra_libs)) + + +.PHONY: $(out_base)/%.o.clean + +$(out_base)/%.o.clean: + $(call message,rm $(basename $(basename $@)),rm -f $(basename $@) $(basename $(basename $@))) diff --git a/build-0.3/c/gnu/o-l.make b/build-0.3/c/gnu/o-l.make new file mode 100644 index 0000000..5c93f0a --- /dev/null +++ b/build-0.3/c/gnu/o-l.make @@ -0,0 +1,92 @@ +# file : build/c/gnu/o-l.make +# 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) + +ifneq ($(c_extra_lib_paths),) +vpath %.so $(c_extra_lib_paths) +vpath %.a $(c_extra_lib_paths) +endif + +ifneq ($(c_gnu_libraries),) +vpath %.so $(c_gnu_libraries) +vpath %.a $(c_gnu_libraries) +endif + +ifdef ld_lib_type + +.PHONY: $(out_base)/%.l.o.clean + +ifeq ($(ld_lib_type),archive) + +$(out_base)/%.l: ar := $(ld_lib_ar) +$(out_base)/%.l: ar_options ?= -rc + +$(out_base)/%.l: ranlib := $(ld_lib_ranlib) +$(out_base)/%.l: ranlib_options ?= + +ifeq ($(out_base),$(src_base)) +$(out_base)/%.l: +else +$(out_base)/%.l: | $$(dir $$@). +endif + $(call message,ar $@,$(ar) $(ar_options) $(@D)/lib$(basename $(@F)).a $(filter %.o,$^)) + $(call message,,$(ranlib) $(ranlib_options) $(@D)/lib$(basename $(@F)).a) + $(call message,,echo "$(@D)/lib$(basename $(@F)).a" >$@) + $(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.so %.l,$^))" | xargs -n 1 echo >>$@) + +$(out_base)/%.l.o.clean: + $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,lib%.a,$(@F)),$(basename $(basename $@))) + +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)),\ +$(shell sed -e 's%^rpath:\(.*\)%-Wl,-rpath,\1%' $1),\ +$(shell sed -e 's%^rpath:\(.*\)%%' $1)) + +ifeq ($(out_base),$(src_base)) +$(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 \ +$(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 |