summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-11-23 03:38:48 -0500
committermidipix <writeonce@midipix.org>2017-11-23 15:42:04 -0500
commit1cc0e3e66b2cfb735cf9d0fc237e37ed7540fc39 (patch)
treeea894a89912dadf5d657d3e41c745c0830d33fe6
parent1640ad873c64a3d1dc64e16d31ca1b8a040e6919 (diff)
downloadperk-1cc0e3e66b2cfb735cf9d0fc237e37ed7540fc39.tar.bz2
perk-1cc0e3e66b2cfb735cf9d0fc237e37ed7540fc39.tar.xz
build system: added --cchost support.
-rw-r--r--Makefile.in9
-rw-r--r--config.project1
-rw-r--r--config.usage2
-rwxr-xr-xconfigure21
-rwxr-xr-xsysinfo/host/host.sh2
5 files changed, 31 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index bae3699..b825744 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -8,6 +8,7 @@ AVOID_VERSION = @avoid_version@
BUILD = @build@
HOST = @host@
+CCHOST = @cchost@
TARGET = @target@
ARCH = @arch@
COMPILER = @compiler@
@@ -231,6 +232,9 @@ dirs.tag:
mkdir -p lib
touch dirs.tag
+cchost:
+ $(PROJECT_DIR)/sysinfo/host/host.sh --compiler="$(CC)" --cflags="$(CFLAGS)"
+
host.tag: Makefile
$(PROJECT_DIR)/sysinfo/host/host.sh --compiler="$(CC)" --cflags="$(CFLAGS)"
touch host.tag
@@ -283,6 +287,7 @@ clean: clean-implib
.display-env:
@echo BUILD:' '$(BUILD)
@echo HOST:' '$(HOST)
+ @echo CCHOST:' '$(CCHOST)
@echo TARGET:' '$(TARGET)
@echo ARCH:' '$(ARCH)
@echo COMPILER:' '$(COMPILER)
@@ -409,8 +414,8 @@ clean: clean-implib
@echo $(CFLAGS)
-.PHONY: all install shared static app \
- package-app \
+.PHONY: cchost package-app \
+ all install shared static app \
shared-objs shared-lib \
shared-soname shared-solink \
package-shared-soname package-shared-solink \
diff --git a/config.project b/config.project
index f90e9e2..099abf2 100644
--- a/config.project
+++ b/config.project
@@ -8,6 +8,7 @@ mb_avoid_version=no
# build
mb_default_build=
mb_default_host=
+mb_default_cchost=
mb_default_target=
mb_default_arch=
mb_default_compiler=
diff --git a/config.usage b/config.usage
index ffc327c..d93852d 100644
--- a/config.usage
+++ b/config.usage
@@ -34,6 +34,7 @@ supported switches:
--build
--host
+ --cchost
--target
--arch
--compiler
@@ -94,6 +95,7 @@ supported variables:
BUILD
HOST
+ CCHOST
TARGET
ARCH
COMPILER
diff --git a/configure b/configure
index dbe5e08..c7bb6ff 100755
--- a/configure
+++ b/configure
@@ -66,6 +66,7 @@ init_vars()
# build
mb_build=$BUILD
mb_host=$HOST
+ mb_cchost=$CCHOST
mb_target=$TARGET
mb_arch=$ARCH
mb_compiler=$COMPILER
@@ -198,6 +199,7 @@ common_defaults()
# build
[ -z "$mb_build" ] && mb_build=$mb_default_build
[ -z "$mb_host" ] && mb_host=$mb_default_host
+ [ -z "$mb_cchost" ] && mb_cchost=$mb_default_cchost
[ -z "$mb_target" ] && mb_target=$mb_default_target
[ -z "$mb_arch" ] && mb_arch=$mb_default_arch
[ -z "$mb_compiler" ] && mb_compiler=$mb_default_compiler
@@ -514,7 +516,21 @@ config_copy()
-e 's^@disable_frontend@^'"$mb_disable_frontend"'^g' \
-e 's^@disable_static@^'"$mb_disable_static"'^g' \
-e 's^@disable_shared@^'"$mb_disable_shared"'^g' \
- $mb_project_dir/Makefile.in > $mb_pwd/Makefile
+ $mb_project_dir/Makefile.in > $mb_pwd/Makefile.tmp || exit 2
+
+ if [ -z "$mb_cchost" ]; then
+ if [ "$mb_host" = 'native' ]; then
+ mb_cchost=`make -s -f $mb_pwd/Makefile.tmp cchost`
+ else
+ mb_cchost=$mb_host
+ fi
+ fi
+
+ sed -e 's^@cchost@^'"$mb_cchost"'^g' $mb_pwd/Makefile.tmp \
+ > $mb_pwd/Makefile.host || exit 2
+
+ rm $mb_pwd/Makefile.tmp || exit 2
+ mv $mb_pwd/Makefile.host $mb_pwd/Makefile || exit 2
}
@@ -645,6 +661,9 @@ for arg ; do
--host=*)
mb_host=${arg#*=}
;;
+ --cchost=*)
+ mb_cchost=${arg#*=}
+ ;;
--target=*)
mb_target=${arg#*=}
;;
diff --git a/sysinfo/host/host.sh b/sysinfo/host/host.sh
index b3975ae..686edca 100755
--- a/sysinfo/host/host.sh
+++ b/sysinfo/host/host.sh
@@ -15,7 +15,7 @@ host_test()
exit 2
fi
- $mb_compiler -dM -E - < /dev/null > /dev/null && return 0
+ $mb_compiler $mb_cflags -dumpmachine && return 0
error_msg "config error: invalid compiler."
exit 2