From 6e886d4233dec3b82a27642f174b920e5f98f6aa Mon Sep 17 00:00:00 2001 From: Caoruihong Date: Wed, 29 Sep 2021 11:40:43 +0800 Subject: [PATCH] feat(build): support gcc toolchain Signed-off-by: Caoruihong Change-Id: I6f2dea19cbd2e5b562bb51e30592205a2bb4fbdb --- BUILD.gn | 135 ++++++++++++++++++----------------- Makefile | 11 +-- apps/Makefile | 11 +-- config.mk | 2 +- drivers/BUILD.gn | 29 ++------ drivers/block/BUILD.gn | 34 +++++++++ drivers/char/BUILD.gn | 42 +++++++++++ drivers/mtd/BUILD.gn | 34 +++++++++ liteos.gni | 64 ++++++++++++++++- tools/build/mk/los_config.mk | 9 ++- tools/build/mk/module.mk | 2 +- 11 files changed, 256 insertions(+), 117 deletions(-) create mode 100644 drivers/block/BUILD.gn create mode 100644 drivers/char/BUILD.gn create mode 100644 drivers/mtd/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index 86e1f12c..d4146236 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -29,17 +29,14 @@ import("//build/lite/config/component/lite_component.gni") +LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h") + declare_args() { tee_enable = false liteos_name = "OHOS_Image" liteos_skip_make = false } -cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi" -HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") - -LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h") - tee = "" if (tee_enable) { tee = "_tee" @@ -68,6 +65,8 @@ import("liteos.gni") assert(ARCH != "", "ARCH not set!") assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch") assert(tee_enable == defined(LOSCFG_TEE_ENABLE), "TEE switch not match!") +assert(ohos_build_compiler == "clang" == defined(LOSCFG_COMPILER_CLANG_LLVM), + "compiler not match!") generate_notice_file("kernel_notice_file") { module_name = "kernel" @@ -83,6 +82,8 @@ generate_notice_file("kernel_notice_file") { ] } +visibility = [ ":*" ] + liteos_arch_cflags = [] if (defined(LOSCFG_ARCH_ARM)) { mcpu = LOSCFG_ARCH_CPU @@ -175,7 +176,7 @@ config("optimize_config") { if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { cflags += [ "-flto=thin" ] } else { - cflags += [ "-flto" ] + #cflags += [ "-flto" ] } } cflags += [ optimization_cflag ] @@ -197,8 +198,10 @@ config("warn_config") { "-Wpointer-arith", "-Wstrict-prototypes", "-Winvalid-pch", - "-Wno-address-of-packed-member", ] + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ "-Wno-address-of-packed-member" ] + } asmflags = cflags } @@ -209,6 +212,7 @@ config("dialect_config") { config("misc_config") { defines = [ "__LITEOS__" ] + defines += [ "__LITEOS_A__" ] if (!defined(LOSCFG_DEBUG_VERSION)) { defines += [ "NDEBUG" ] } @@ -248,62 +252,8 @@ config("los_config") { ] } -executable("liteos") { - configs = [] # clear default configs - configs += [ ":arch_config" ] - configs += [ ":public" ] - - ldflags = [ - "-static", - "-nostdlib", - "-Wl,--gc-sections", - "-Wl,-Map=$liteos_name.map", - "-Wl,--no-eh-frame-hdr", - ] - - libgcc = exec_script("//build/lite/run_shell_cmd.py", - [ "$cc -print-libgcc-file-name" ], - "trim string") - libs = [ libgcc ] - if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { - ldflags += - [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ] - inputs = [ "tools/build/liteos_llvm.ld" ] - } else { - ldflags += - [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ] - ldflags += [ "-Wl,-nostartfiles" ] - inputs = [ "tools/build/liteos.ld" ] - } - - inputs += [ "$root_out_dir/board.ld" ] - - output_dir = target_out_dir - - deps = [ - ":modules", - "platform:copy_board.ld", - ] -} - -copy("copy_liteos") { - deps = [ ":liteos" ] - sources = [ "$target_out_dir/unstripped/bin/liteos" ] - outputs = [ "$root_out_dir/$liteos_name" ] -} - -build_ext_component("build_kernel_image") { - deps = [ ":copy_liteos" ] - exec_path = rebase_path(root_out_dir) - - objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix" - objdump = "${compile_prefix}objdump$toolchain_cmd_suffix" - - command = "$objcopy -O binary $liteos_name $liteos_name.bin" - command += - " && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'" - command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'" -} +cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi" +HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") config("public") { configs = [ @@ -364,16 +314,69 @@ group("tests") { group("kernel") { deps = [ ":build_kernel_image" ] + visibility += [ "//build/lite:ohos" ] } group("liteos_a") { +} + +executable("liteos") { + configs = [] # clear default configs + configs += [ ":arch_config" ] + configs += [ ":public" ] + + ldflags = [ + "-static", + "-nostdlib", + "-Wl,--gc-sections", + "-Wl,-Map=$liteos_name.map", + "-Wl,--no-eh-frame-hdr", + ] + + libgcc = exec_script("//build/lite/run_shell_cmd.py", + [ "$cc -print-libgcc-file-name" ], + "trim string") + libs = [ libgcc ] + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + ldflags += + [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ] + inputs = [ "tools/build/liteos_llvm.ld" ] + } else { + ldflags += + [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ] + ldflags += [ "-Wl,-nostartfiles" ] + inputs = [ "tools/build/liteos.ld" ] + } + + inputs += [ "$root_out_dir/board.ld" ] + + output_dir = target_out_dir + deps = [ - ":apps", - ":kernel", - ":tests", + ":modules", + "platform:copy_board.ld", ] } +copy("copy_liteos") { + deps = [ ":liteos" ] + sources = [ "$target_out_dir/unstripped/bin/liteos" ] + outputs = [ "$root_out_dir/$liteos_name" ] +} + +build_ext_component("build_kernel_image") { + deps = [ ":copy_liteos" ] + exec_path = rebase_path(root_out_dir) + + objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix" + objdump = "${compile_prefix}objdump$toolchain_cmd_suffix" + + command = "$objcopy -O binary $liteos_name $liteos_name.bin" + command += + " && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'" + command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'" +} + build_ext_component("make") { exec_path = rebase_path(".", root_build_dir) outdir = rebase_path("$target_out_dir/${target_name}_out") diff --git a/Makefile b/Makefile index 780d5b6d..9c026c66 100644 --- a/Makefile +++ b/Makefile @@ -61,12 +61,6 @@ endif KCONFIG_CONFIG ?= $(CONFIG) SYSROOT_PATH ?= $(OUT)/sysroot -LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h -LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config - -# export los_config.mk related environment variables -export LITEOS_MENUCONFIG_H -export LITEOS_CONFIG_FILE # export subdir Makefile related environment variables export SYSROOT_PATH @@ -125,7 +119,6 @@ help: sysroot: $(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH)) -ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) ifeq ($(origin SYSROOT_PATH),file) $(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \ ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \ @@ -135,11 +128,9 @@ ifeq ($(origin SYSROOT_PATH),file) ARCH_CFLAGS="$(LITEOS_CORE_COPTS) -w" \ TOPDIR="$(LITEOSTOPDIR)/../.." \ SYSROOTDIR="$(SYSROOT_PATH)" \ - CLANG="$(LITEOS_COMPILER_PATH)clang" \ - BUILD_ALL_MULTILIB=false \ + $(if $(LOSCFG_COMPILER_CLANG_LLVM),CLANG="$(LITEOS_COMPILER_PATH)clang",GCC="$(CC)") \ BUILD_DEBUG=$(if $(patsubst y,,$(or $(RELEASE:1=y),n)),true,false) endif -endif $(filter-out menuconfig,$(KCONFIG_CMDS)): $(HIDE)$@ $(args) diff --git a/apps/Makefile b/apps/Makefile index 7259e2f6..363c914b 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -34,14 +34,7 @@ export APPSTOPDIR include $(APPSTOPDIR)/config.mk -all: -ifneq ($(APP_SUBDIRS), ) - $(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done -endif - -clean: -ifneq ($(APP_SUBDIRS), ) - $(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir clean || exit 1; done -endif +all clean: + $(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir $@ || exit 1; done .PHONY: all clean diff --git a/config.mk b/config.mk index a4fd387b..8007d9ed 100644 --- a/config.mk +++ b/config.mk @@ -38,7 +38,7 @@ LITEOS_CXXOPTS := $(LITEOS_CXXOPTS_BASE) LITEOS_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_EXTKERNEL_INCLUDE) \ $(LITEOS_COMPAT_INCLUDE) $(LITEOS_FS_INCLUDE) \ $(LITEOS_NET_INCLUDE) $(LITEOS_LIB_INCLUDE) \ - $(LITEOS_DRIVERS_INCLUDE) $(LOSCFG_TOOLS_DEBUG_INCLUDE) \ + $(LITEOS_DRIVERS_INCLUDE) $(LITEOS_TOOLS_DEBUG_INCLUDE) \ $(LITEOS_PLATFORM_INCLUDE) $(LITEOS_DFX_INCLUDE) \ $(LITEOS_SECURITY_INCLUDE) LITEOS_LIBDEP := $(LITEOS_BASELIB) diff --git a/drivers/BUILD.gn b/drivers/BUILD.gn index ae8b7b45..d9e29eaa 100644 --- a/drivers/BUILD.gn +++ b/drivers/BUILD.gn @@ -29,29 +29,10 @@ import("//kernel/liteos_a/liteos.gni") -group("drivers") { - deps = [ - "block/disk", - "char/bch", - "char/mem", - "char/perf", - "char/quickstart", - "char/random", - "char/trace", - "char/video", - "mtd/multi_partition", - ] -} - -config("public") { - configs = [ - "block/disk:public", - "char/bch:public", - "char/mem:public", - "char/quickstart:public", - "char/random:public", - "char/video:public", - "char/trace:public", - "mtd/multi_partition:public", +module_group("drivers") { + modules = [ + "block", + "char", + "mtd", ] } diff --git a/drivers/block/BUILD.gn b/drivers/block/BUILD.gn new file mode 100644 index 00000000..d41dafe4 --- /dev/null +++ b/drivers/block/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_group("block") { + modules = [ "disk" ] +} diff --git a/drivers/char/BUILD.gn b/drivers/char/BUILD.gn new file mode 100644 index 00000000..9044b2f8 --- /dev/null +++ b/drivers/char/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_group("char") { + modules = [ + "bch", + "mem", + "perf", + "quickstart", + "random", + "trace", + "video", + ] +} diff --git a/drivers/mtd/BUILD.gn b/drivers/mtd/BUILD.gn new file mode 100644 index 00000000..5a1be361 --- /dev/null +++ b/drivers/mtd/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_group("mtd") { + modules = [ "multi_partition" ] +} diff --git a/liteos.gni b/liteos.gni index 25c1b404..1d69c315 100644 --- a/liteos.gni +++ b/liteos.gni @@ -41,28 +41,58 @@ if (defined(LOSCFG_ARCH_ARM_AARCH32)) { } template("kernel_module") { + build_gn = rebase_path("BUILD.gn") + cmd = "grep -c '^\s*\(kernel_module\|hdf_driver\)\s*(\s*\S*\s*)\s*{\s*\$' $build_gn" + modules_count = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + if (modules_count == 1) { + auto_config = true + } + + cmd = "if grep -q '^\s*\(config\s*(\s*\"public\"\s*)\|module_group\s*(\s*\"\S*\"\s*)\)\s*{\s*\$' $build_gn; then echo true; else echo false; fi" + has_public_config = + exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + if (!has_public_config && defined(auto_config)) { + config("public") { + configs = [] + } + } + current_dir_name = get_path_info(rebase_path("."), "file") if (target_name != current_dir_name) { - build_gn = rebase_path("BUILD.gn") - cmd = "if grep -q '^\s*group\s*(\s*\"$current_dir_name\"\s*)\s*{\s*\$' $build_gn; then echo true; else echo false; fi" + cmd = "if grep -q '^\s*\(module_group\|group\)\s*(\s*\"$current_dir_name\"\s*)\s*{\s*\$' $build_gn; then echo true; else echo false; fi" has_current_dir_group = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") - if (!has_current_dir_group) { + if (!has_current_dir_group && defined(auto_config)) { module_name = target_name group(current_dir_name) { public_deps = [ ":$module_name" ] } } } + if (defined(invoker.module_switch) && !invoker.module_switch) { group(target_name) { not_needed(invoker, "*") } } else { source_set(target_name) { + public_configs = [] forward_variables_from(invoker, "*") + if (has_public_config) { + included_public_config = false + foreach(cfg, public_configs) { + what = "label_no_toolchain" + if (get_label_info(cfg, what) == get_label_info(":public", what)) { + included_public_config = true + } + } + if (!included_public_config) { + public_configs += [ ":public" ] + } + } } } + not_needed([ "auto_config" ]) } template("config") { @@ -77,9 +107,37 @@ template("config") { } } +template("module_group") { + assert(defined(invoker.modules), "modules are must") + group(target_name) { + deps = [] + foreach(m, invoker.modules) { + deps += [ m ] + } + if (defined(invoker.deps)) { + deps += invoker.deps + } + } + config("public") { + configs = [] + foreach(m, invoker.modules) { + configs += [ "$m:public" ] + } + if (defined(invoker.configs)) { + configs += invoker.configs + } + } +} + set_defaults("kernel_module") { configs = [ "$LITEOSTOPDIR:public", "$LITEOSTOPDIR:los_config", ] + visibility = [ + "$LITEOSTOPDIR:*", + ":*", + "..:*", + "../..:*", + ] } diff --git a/tools/build/mk/los_config.mk b/tools/build/mk/los_config.mk index b34bf745..81c6fbb7 100644 --- a/tools/build/mk/los_config.mk +++ b/tools/build/mk/los_config.mk @@ -27,6 +27,9 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h +LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config + -include $(LITEOS_CONFIG_FILE) ifeq ($(ARCH),) @@ -46,7 +49,7 @@ get_compiler_path = $(or $(wildcard $(1)),$(dir $(shell which $(CROSS_COMPILE)as ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) CROSS_COMPILE ?= llvm- LITEOS_COMPILER_PATH ?= $(call get_compiler_path,$(LITEOSTOPDIR)/../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/) -LLVM_TARGET = $(if $(LOSCFG_LLVM_TARGET),-target $(LOSCFG_LLVM_TARGET),) +LLVM_TARGET = $(if $(LOSCFG_LLVM_TARGET:"%"=%),--target=$(LOSCFG_LLVM_TARGET:"%"=%),) LLVM_SYSROOT = $(if $(SYSROOT_PATH),--sysroot=$(SYSROOT_PATH),) CC = $(LITEOS_COMPILER_PATH)clang $(LLVM_TARGET) $(LLVM_SYSROOT) AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as @@ -59,7 +62,7 @@ SIZE = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)size NM = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)nm STRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip else ifeq ($(LOSCFG_COMPILER_GCC), y) -CROSS_COMPILE ?= $(LOSCFG_CROSS_COMPILE) +CROSS_COMPILE ?= $(LOSCFG_CROSS_COMPILE:"%"=%) LITEOS_COMPILER_PATH ?= $(call get_compiler_path,$(LITEOSTOPDIR)/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin/) CC = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)gcc AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as @@ -542,7 +545,7 @@ LITEOS_DFX_INCLUDE := $(LITEOS_HILOG_INCLUDE) \ $(LITEOS_HIDUMPER_INCLUDE) LITEOS_SECURITY_INCLUDE := $(LITEOS_SECURITY_CAP_INC) $(LITEOS_SECURITY_VID_INC) -LOSCFG_TOOLS_DEBUG_INCLUDE := $(LITEOS_SHELL_INCLUDE) $(LITEOS_UART_INCLUDE) \ +LITEOS_TOOLS_DEBUG_INCLUDE := $(LITEOS_SHELL_INCLUDE) $(LITEOS_UART_INCLUDE) \ $(LITEOS_TELNET_INCLUDE) LITEOS_COMMON_OPTS := -fno-pic -fno-builtin -nostdinc -nostdlib -Wall -Werror -fms-extensions -fno-omit-frame-pointer -Wno-address-of-packed-member -Winvalid-pch diff --git a/tools/build/mk/module.mk b/tools/build/mk/module.mk index 23820b6d..7fc3d907 100644 --- a/tools/build/mk/module.mk +++ b/tools/build/mk/module.mk @@ -37,7 +37,7 @@ LOCAL_OBJS = $(addprefix $(OBJOUT)/,$(addsuffix .o,$(basename $(subst $(TOPDIR)/ all : $(TARGET) ifeq ($(HIDE),@) -ECHO = $1 = echo " $1" $$(patsubst $$(OUT)/%,%,$$@) && $($1) +ECHO = $1 = echo " $1" $$(patsubst $$(OUT)/%,%,$$@) && $1(){ if ! $($1) "$$$$@"; then echo command details: $($1) "$$$$@"; false; fi;};$1 $(foreach cmd,CC GPP AS AR LD,$(eval $(call ECHO,$(cmd)))) endif -- GitLab