[OpenWrt-Devel] [PATCH] allow HOST* variables to be set from config.
Lawrence D'Anna
larry at elder-gods.org
Sun Jul 19 23:25:39 EDT 2015
These HOST* variables are used to configure all the build-time tools, but the
user has no ability to modify them without editing makefiles.
This patch adds a new menu to menuconfig which allows the user to set the host
compilers and flags.
Signed-off-by: Lawrence D'Anna <larry at elder-gods.org>
---
Config.in | 2 ++
config/Config-host.in | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
rules.mk | 10 +++++-----
3 files changed, 56 insertions(+), 5 deletions(-)
create mode 100644 config/Config-host.in
diff --git a/Config.in b/Config.in
index d30c048..d794be8 100644
--- a/Config.in
+++ b/Config.in
@@ -15,6 +15,8 @@ config HAVE_DOT_CONFIG
bool
default y
+source "config/Config-host.in"
+
source "target/Config.in"
source "config/Config-images.in"
diff --git a/config/Config-host.in b/config/Config-host.in
new file mode 100644
index 0000000..fb999e6
--- /dev/null
+++ b/config/Config-host.in
@@ -0,0 +1,49 @@
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+menu "Host build settings"
+
+ config HOSTCC
+ string
+ prompt "Host C compiler"
+ default "gcc"
+ help
+ Specifies the C compiler used to build programs which will run at
+ build time.
+
+ config HOSTCXX
+ string
+ prompt "Host C++ compiler"
+ default "g++"
+ help
+ Specifies the C++ compiler used to build programs which will run at
+ build time.
+
+ config HOST_CPPFLAGS
+ string
+ prompt "Host C preprocessor flags"
+ default ""
+ help
+ Specifies the C preprocessor flags used to build programs which will run
+ at build time.
+
+ config HOST_CFLAGS
+ string
+ prompt "Host C compiler flags"
+ default "-O2"
+ help
+ Specifies the C compiler flags used to build progams which will run
+ at build time.
+
+ config HOST_LDFLAGS
+ string
+ prompt "Host linker flags"
+ default ""
+ help
+ Specifies the linker flags used to build progams which will run
+ at build time.
+
+endmenu
diff --git a/rules.mk b/rules.mk
index 58b9f3e..ef0a7b0 100644
--- a/rules.mk
+++ b/rules.mk
@@ -195,11 +195,11 @@ PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
export PKG_CONFIG
-HOSTCC:=gcc
-HOSTCXX:=g++
-HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include -I$(STAGING_DIR_HOST)/usr/include
-HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
-HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib -L$(STAGING_DIR_HOST)/usr/lib
+HOSTCC:=$(call qstrip,$(CONFIG_HOSTCC))
+HOSTCXX:=$(call qstrip,$(CONFIG_HOSTCXX))
+HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include -I$(STAGING_DIR_HOST)/usr/include $(call qstrip,$(CONFIG_HOST_CPPFLAGS))
+HOST_CFLAGS:=$(HOST_CPPFLAGS) $(call qstrip,$(CONFIG_HOST_CFLAGS))
+HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib -L$(STAGING_DIR_HOST)/usr/lib $(call qstrip,$(CONFIG_HOST_LDFLAGS))
ifeq ($(CONFIG_GCC_VERSION_4_4)$(CONFIG_GCC_VERSION_4_6)$(CONFIG_EXTERNAL_TOOLCHAIN),)
TARGET_AR:=$(TARGET_CROSS)gcc-ar
--
2.3.8 (Apple Git-58)
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list