summaryrefslogtreecommitdiff
path: root/build-0.3/c/generic
diff options
context:
space:
mode:
authorJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
committerJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
commita15cf65c44d5c224169c32ef5495b68c758134b7 (patch)
tree3419f58fc8e1b315ba8171910ee044c5d467c162 /build-0.3/c/generic
Imported Upstream version 3.3.0.2upstream/3.3.0.2
Diffstat (limited to 'build-0.3/c/generic')
-rw-r--r--build-0.3/c/generic/c-d.make19
-rw-r--r--build-0.3/c/generic/c-o.make40
-rw-r--r--build-0.3/c/generic/configuration-rules.make15
-rw-r--r--build-0.3/c/generic/configuration-sl-rules.make15
-rw-r--r--build-0.3/c/generic/configuration-sl.make21
-rw-r--r--build-0.3/c/generic/configuration.make22
-rwxr-xr-xbuild-0.3/c/generic/configure28
-rwxr-xr-xbuild-0.3/c/generic/configure-sl37
-rw-r--r--build-0.3/c/generic/o-e.make28
-rw-r--r--build-0.3/c/generic/o-l.make64
10 files changed, 289 insertions, 0 deletions
diff --git a/build-0.3/c/generic/c-d.make b/build-0.3/c/generic/c-d.make
new file mode 100644
index 0000000..8f77d50
--- /dev/null
+++ b/build-0.3/c/generic/c-d.make
@@ -0,0 +1,19 @@
+# file : build/c/generic/c-o.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include,$(bld_root)/c/generic/configuration.make)
+
+# Make will try to build dependecies (since they are ultimately included
+# files) during configuartion phase without c_generic being discovered
+# yet. This is also why dependecies should be included with -include.
+#
+ifdef c_generic
+
+.PHONY: $(out_base)/%.o.d.$(c_s_suffix).clean
+
+$(out_base)/%.o.d.$(c_s_suffix).clean:
+ @:
+
+endif
diff --git a/build-0.3/c/generic/c-o.make b/build-0.3/c/generic/c-o.make
new file mode 100644
index 0000000..7b6e622
--- /dev/null
+++ b/build-0.3/c/generic/c-o.make
@@ -0,0 +1,40 @@
+# file : build/c/generic/c-o.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 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/generic/configuration.make)
+
+$(out_base)/%.o: c := $(c_generic)
+
+#@@ 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) $(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) $(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/generic/configuration-rules.make b/build-0.3/c/generic/configuration-rules.make
new file mode 100644
index 0000000..5fa9117
--- /dev/null
+++ b/build-0.3/c/generic/configuration-rules.make
@@ -0,0 +1,15 @@
+# file : build/c/generic/configuration-rules.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(dcf_root)/c/generic/configuration-dynamic.make: | $(dcf_root)/c/generic/.
+ $(call message,,$(bld_root)/c/generic/configure $@)
+
+ifndef %foreign%
+
+disfigure::
+ $(call message,rm $(dcf_root)/c/generic/configuration-dynamic.make,\
+rm -f $(dcf_root)/c/generic/configuration-dynamic.make)
+
+endif
diff --git a/build-0.3/c/generic/configuration-sl-rules.make b/build-0.3/c/generic/configuration-sl-rules.make
new file mode 100644
index 0000000..e685be6
--- /dev/null
+++ b/build-0.3/c/generic/configuration-sl-rules.make
@@ -0,0 +1,15 @@
+# file : build/c/generic/configuration-sl-rules.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(dcf_root)/c/generic/configuration-sl-dynamic.make: | $(dcf_root)/c/generic/.
+ $(call message,,$(bld_root)/c/generic/configure-sl $@)
+
+ifndef %foreign%
+
+disfigure::
+ $(call message,rm $(dcf_root)/c/generic/configuration-sl-dynamic.make,\
+rm -f $(dcf_root)/c/generic/configuration-sl-dynamic.make)
+
+endif
diff --git a/build-0.3/c/generic/configuration-sl.make b/build-0.3/c/generic/configuration-sl.make
new file mode 100644
index 0000000..b3a18a8
--- /dev/null
+++ b/build-0.3/c/generic/configuration-sl.make
@@ -0,0 +1,21 @@
+# file : build/c/generic/configuration-sl.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 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))
+
+# Dynamic configuration.
+#
+c_generic_pic_option :=
+
+$(call -include,$(dcf_root)/c/generic/configuration-sl-dynamic.make)
+
+ifdef c_generic_pic_option
+
+$(out_root)/%: c_generic_pic_option := $(c_generic_pic_option)
+$(out_root)/%: c_generic_shared_option := $(c_generic_shared_option)
+
+else
+.NOTPARALLEL:
+endif
diff --git a/build-0.3/c/generic/configuration.make b/build-0.3/c/generic/configuration.make
new file mode 100644
index 0000000..95e79f8
--- /dev/null
+++ b/build-0.3/c/generic/configuration.make
@@ -0,0 +1,22 @@
+# file : build/c/generic/configuration.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include-once,$(bld_root)/c/generic/configuration-rules.make,$(dcf_root))
+
+# Static configuration.
+#
+ifneq ($(bld_root),$(scf_root))
+$(call -include,$(scf_root)/c/generic/configuration-static.make)
+endif
+
+# Dynamic configuration.
+#
+c_generic :=
+
+$(call -include,$(dcf_root)/c/generic/configuration-dynamic.make)
+
+ifndef c_generic
+.NOTPARALLEL:
+endif
diff --git a/build-0.3/c/generic/configure b/build-0.3/c/generic/configure
new file mode 100755
index 0000000..76be8df
--- /dev/null
+++ b/build-0.3/c/generic/configure
@@ -0,0 +1,28 @@
+#! /usr/bin/env bash
+
+# file : build/c/generic/configure
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# $1 out file
+#
+# bld_root - build root
+# project_name - project name
+#
+
+source $bld_root/dialog.bash
+
+$echo
+$echo
+$echo "configuring '$project_name'"
+$echo
+$echo
+
+$echo
+$echo "Please enter the C compiler executable you would like to use."
+$echo
+
+c_generic=`read_path --command`
+
+echo "c_generic := $c_generic" > $1
diff --git a/build-0.3/c/generic/configure-sl b/build-0.3/c/generic/configure-sl
new file mode 100755
index 0000000..5500e8b
--- /dev/null
+++ b/build-0.3/c/generic/configure-sl
@@ -0,0 +1,37 @@
+#! /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
+# license : GNU GPL v2; see accompanying LICENSE file
+
+# $1 out file
+#
+# bld_root - build root
+# project_name - project name
+#
+
+source $bld_root/dialog.bash
+
+$echo
+$echo
+$echo "configuring '$project_name'"
+$echo
+$echo
+
+$echo
+$echo "Please enter C compiler option(s) used to build position-"
+$echo "independent code (e.g., -fPIC, -Kpic, etc)."
+$echo
+
+read -e -p "[]: " pic_option
+
+$echo
+$echo "Please enter C compiler option(s) used to build shared"
+$echo "libraries (e.g., -shared, -G, etc)."
+$echo
+
+read -e -p "[]: " shared_option
+
+echo "c_generic_pic_option := $pic_option" > $1
+echo "c_generic_shared_option := $shared_option" >> $1
diff --git a/build-0.3/c/generic/o-e.make b/build-0.3/c/generic/o-e.make
new file mode 100644
index 0000000..4a88a0f
--- /dev/null
+++ b/build-0.3/c/generic/o-e.make
@@ -0,0 +1,28 @@
+# file : build/c/generic/o-e.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include,$(bld_root)/c/generic/configuration.make)
+
+ifneq ($(c_extra_lib_paths),)
+vpath %.so $(c_extra_lib_paths)
+vpath %.a $(c_extra_lib_paths)
+endif
+
+$(out_base)/%: ld := $(c_generic)
+$(out_base)/%: expand-l = $(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/generic/o-l.make b/build-0.3/c/generic/o-l.make
new file mode 100644
index 0000000..cee21af
--- /dev/null
+++ b/build-0.3/c/generic/o-l.make
@@ -0,0 +1,64 @@
+# file : build/c/generic/o-l.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include,$(bld_root)/c/generic/configuration.make)
+
+ifeq ($(ld_lib_type),shared)
+$(call include,$(bld_root)/c/generic/configuration-sl.make)
+endif
+
+ifneq ($(c_extra_lib_paths),)
+vpath %.so $(c_extra_lib_paths)
+vpath %.a $(c_extra_lib_paths)
+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
+
+$(out_base)/%.l: ld := $(c_generic)
+$(out_base)/%.l: c_pic_options := $(c_generic_pic_option)
+$(out_base)/%.l: expand-l = $(shell sed -e 's%^rpath:\(.*\)%%' $1)
+
+ifeq ($(out_base),$(src_base))
+$(out_base)/%.l:
+else
+$(out_base)/%.l: | $$(dir $$@).
+endif
+ $(call message,ld $@,$(ld) $(c_generic_shared_option) \
+$(c_extra_options) $(ld_options) $(c_ld_extra_options) -o $(@D)/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 >>$@)
+
+$(out_base)/%.l.o.clean:
+ $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,lib%.so,$(@F)),$(basename $(basename $@)))
+
+endif
+endif