!643 添加对GCC工具链的支持

Merge pull request !643 from Caoruihong/support_gcc
This commit is contained in:
openharmony_ci 2021-12-08 07:20:38 +00:00 committed by Gitee
commit 144214869f
11 changed files with 257 additions and 118 deletions

137
BUILD.gn
View File

@ -29,17 +29,14 @@
import("//build/lite/config/component/lite_component.gni") import("//build/lite/config/component/lite_component.gni")
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
declare_args() { declare_args() {
tee_enable = false tee_enable = false
liteos_name = "OHOS_Image" liteos_name = "OHOS_Image"
liteos_skip_make = false 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 = "" tee = ""
if (tee_enable) { if (tee_enable) {
tee = "_tee" tee = "_tee"
@ -68,6 +65,8 @@ import("liteos.gni")
assert(ARCH != "", "ARCH not set!") assert(ARCH != "", "ARCH not set!")
assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch") assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch")
assert(tee_enable == defined(LOSCFG_TEE_ENABLE), "TEE switch not match!") 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") { generate_notice_file("kernel_notice_file") {
module_name = "kernel" module_name = "kernel"
@ -83,6 +82,8 @@ generate_notice_file("kernel_notice_file") {
] ]
} }
visibility = [ ":*" ]
liteos_arch_cflags = [] liteos_arch_cflags = []
if (defined(LOSCFG_ARCH_ARM)) { if (defined(LOSCFG_ARCH_ARM)) {
mcpu = LOSCFG_ARCH_CPU mcpu = LOSCFG_ARCH_CPU
@ -175,7 +176,7 @@ config("optimize_config") {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-flto=thin" ] cflags += [ "-flto=thin" ]
} else { } else {
cflags += [ "-flto" ] #cflags += [ "-flto" ]
} }
} }
cflags += [ optimization_cflag ] cflags += [ optimization_cflag ]
@ -197,8 +198,10 @@ config("warn_config") {
"-Wpointer-arith", "-Wpointer-arith",
"-Wstrict-prototypes", "-Wstrict-prototypes",
"-Winvalid-pch", "-Winvalid-pch",
"-Wno-address-of-packed-member",
] ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-Wno-address-of-packed-member" ]
}
asmflags = cflags asmflags = cflags
} }
@ -209,6 +212,7 @@ config("dialect_config") {
config("misc_config") { config("misc_config") {
defines = [ "__LITEOS__" ] defines = [ "__LITEOS__" ]
defines += [ "__LITEOS_A__" ]
if (!defined(LOSCFG_DEBUG_VERSION)) { if (!defined(LOSCFG_DEBUG_VERSION)) {
defines += [ "NDEBUG" ] defines += [ "NDEBUG" ]
} }
@ -248,62 +252,8 @@ config("los_config") {
] ]
} }
executable("liteos") { cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
configs = [] # clear default configs HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
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'"
}
config("public") { config("public") {
configs = [ configs = [
@ -364,14 +314,67 @@ group("tests") {
group("kernel") { group("kernel") {
deps = [ ":build_kernel_image" ] deps = [ ":build_kernel_image" ]
visibility += [ "//build/lite:ohos" ]
} }
group("liteos_a") { group("liteos_a") {
deps = [ }
":apps",
":kernel", executable("liteos") {
":tests", 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'"
} }
build_ext_component("make") { build_ext_component("make") {

View File

@ -61,12 +61,6 @@ endif
KCONFIG_CONFIG ?= $(CONFIG) KCONFIG_CONFIG ?= $(CONFIG)
SYSROOT_PATH ?= $(OUT)/sysroot 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 subdir Makefile related environment variables
export SYSROOT_PATH export SYSROOT_PATH
@ -125,7 +119,6 @@ help:
sysroot: sysroot:
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH)) $(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
ifeq ($(origin SYSROOT_PATH),file) ifeq ($(origin SYSROOT_PATH),file)
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \ $(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \ ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \
@ -135,11 +128,9 @@ ifeq ($(origin SYSROOT_PATH),file)
ARCH_CFLAGS="$(LITEOS_CORE_COPTS) -w" \ ARCH_CFLAGS="$(LITEOS_CORE_COPTS) -w" \
TOPDIR="$(LITEOSTOPDIR)/../.." \ TOPDIR="$(LITEOSTOPDIR)/../.." \
SYSROOTDIR="$(SYSROOT_PATH)" \ SYSROOTDIR="$(SYSROOT_PATH)" \
CLANG="$(LITEOS_COMPILER_PATH)clang" \ $(if $(LOSCFG_COMPILER_CLANG_LLVM),CLANG="$(LITEOS_COMPILER_PATH)clang",GCC="$(CC)") \
BUILD_ALL_MULTILIB=false \
BUILD_DEBUG=$(if $(patsubst y,,$(or $(RELEASE:1=y),n)),true,false) BUILD_DEBUG=$(if $(patsubst y,,$(or $(RELEASE:1=y),n)),true,false)
endif endif
endif
$(filter-out menuconfig,$(KCONFIG_CMDS)): $(filter-out menuconfig,$(KCONFIG_CMDS)):
$(HIDE)$@ $(args) $(HIDE)$@ $(args)

View File

@ -34,14 +34,7 @@ export APPSTOPDIR
include $(APPSTOPDIR)/config.mk include $(APPSTOPDIR)/config.mk
all: all clean:
ifneq ($(APP_SUBDIRS), ) $(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir $@ || exit 1; done
$(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
.PHONY: all clean .PHONY: all clean

View File

@ -38,7 +38,7 @@ LITEOS_CXXOPTS := $(LITEOS_CXXOPTS_BASE)
LITEOS_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_EXTKERNEL_INCLUDE) \ LITEOS_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_EXTKERNEL_INCLUDE) \
$(LITEOS_COMPAT_INCLUDE) $(LITEOS_FS_INCLUDE) \ $(LITEOS_COMPAT_INCLUDE) $(LITEOS_FS_INCLUDE) \
$(LITEOS_NET_INCLUDE) $(LITEOS_LIB_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_PLATFORM_INCLUDE) $(LITEOS_DFX_INCLUDE) \
$(LITEOS_SECURITY_INCLUDE) $(LITEOS_SECURITY_INCLUDE)
LITEOS_LIBDEP := $(LITEOS_BASELIB) LITEOS_LIBDEP := $(LITEOS_BASELIB)

View File

@ -29,29 +29,10 @@
import("//kernel/liteos_a/liteos.gni") import("//kernel/liteos_a/liteos.gni")
group("drivers") { module_group("drivers") {
deps = [ modules = [
"block/disk", "block",
"char/bch", "char",
"char/mem", "mtd",
"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",
] ]
} }

34
drivers/block/BUILD.gn Normal file
View File

@ -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" ]
}

42
drivers/char/BUILD.gn Normal file
View File

@ -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",
]
}

34
drivers/mtd/BUILD.gn Normal file
View File

@ -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" ]
}

View File

@ -41,28 +41,58 @@ if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
} }
template("kernel_module") { 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") current_dir_name = get_path_info(rebase_path("."), "file")
if (target_name != current_dir_name) { if (target_name != current_dir_name) {
build_gn = rebase_path("BUILD.gn") 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"
cmd = "if grep -q '^\s*group\s*(\s*\"$current_dir_name\"\s*)\s*{\s*\$' $build_gn; then echo true; else echo false; fi"
has_current_dir_group = has_current_dir_group =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 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 module_name = target_name
group(current_dir_name) { group(current_dir_name) {
public_deps = [ ":$module_name" ] public_deps = [ ":$module_name" ]
} }
} }
} }
if (defined(invoker.module_switch) && !invoker.module_switch) { if (defined(invoker.module_switch) && !invoker.module_switch) {
group(target_name) { group(target_name) {
not_needed(invoker, "*") not_needed(invoker, "*")
} }
} else { } else {
source_set(target_name) { source_set(target_name) {
public_configs = []
forward_variables_from(invoker, "*") 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") { 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") { set_defaults("kernel_module") {
configs = [ configs = [
"$LITEOSTOPDIR:public", "$LITEOSTOPDIR:public",
"$LITEOSTOPDIR:los_config", "$LITEOSTOPDIR:los_config",
] ]
visibility = [
"$LITEOSTOPDIR:*",
":*",
"..:*",
"../..:*",
]
} }

View File

@ -27,6 +27,9 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h
LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config
-include $(LITEOS_CONFIG_FILE) -include $(LITEOS_CONFIG_FILE)
ifeq ($(ARCH),) ifeq ($(ARCH),)
@ -46,7 +49,7 @@ get_compiler_path = $(or $(wildcard $(1)),$(dir $(shell which $(CROSS_COMPILE)as
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
CROSS_COMPILE ?= llvm- CROSS_COMPILE ?= llvm-
LITEOS_COMPILER_PATH ?= $(call get_compiler_path,$(LITEOSTOPDIR)/../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/) 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),) LLVM_SYSROOT = $(if $(SYSROOT_PATH),--sysroot=$(SYSROOT_PATH),)
CC = $(LITEOS_COMPILER_PATH)clang $(LLVM_TARGET) $(LLVM_SYSROOT) CC = $(LITEOS_COMPILER_PATH)clang $(LLVM_TARGET) $(LLVM_SYSROOT)
AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as 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 NM = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)nm
STRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip STRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip
else ifeq ($(LOSCFG_COMPILER_GCC), y) 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/) 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 CC = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)gcc
AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as
@ -542,7 +545,7 @@ LITEOS_DFX_INCLUDE := $(LITEOS_HILOG_INCLUDE) \
$(LITEOS_HIDUMPER_INCLUDE) $(LITEOS_HIDUMPER_INCLUDE)
LITEOS_SECURITY_INCLUDE := $(LITEOS_SECURITY_CAP_INC) $(LITEOS_SECURITY_VID_INC) 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_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 LITEOS_COMMON_OPTS := -fno-pic -fno-builtin -nostdinc -nostdlib -Wall -Werror -fms-extensions -fno-omit-frame-pointer -Wno-address-of-packed-member -Winvalid-pch

View File

@ -37,7 +37,7 @@ LOCAL_OBJS = $(addprefix $(OBJOUT)/,$(addsuffix .o,$(basename $(subst $(TOPDIR)/
all : $(TARGET) all : $(TARGET)
ifeq ($(HIDE),@) 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)))) $(foreach cmd,CC GPP AS AR LD,$(eval $(call ECHO,$(cmd))))
endif endif