提交 84ea5528 编写于 作者: C Caoruihong

chore(build): optimize build scripts

Signed-off-by: NCaoruihong <crh.cao@huawei.com>
Change-Id: I672b7e6109563d457d493c08903bb5a1dff118ad
上级 746acf55
......@@ -29,53 +29,24 @@
import("//kernel/liteos_m/liteos.gni")
group("arch") {
if ("$board_cpu" == "cortex-m3") {
deps = [ "arm/cortex-m3/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m4") {
deps = [ "arm/cortex-m4/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m7") {
deps = [ "arm/cortex-m7/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m33") {
if (defined(LOSCFG_SECURE_TRUSTZONE)) {
deps = [ "arm/cortex-m33/gcc/TZ:arch" ]
} else {
deps = [ "arm/cortex-m33/gcc/NTZ:arch" ]
}
config("arch_config") {
include_dirs = [ "include" ]
}
module_group("arch") {
modules = []
if ("$board_cpu" == "arm9" || "$board_cpu" == "cortex-m3" ||
"$board_cpu" == "cortex-m4" || "$board_cpu" == "cortex-m7" ||
"$board_cpu" == "cortex-m33") {
modules += [ "arm" ]
} else if ("$board_cpu" == "ck802" || "$board_cpu" == "e802") {
deps = [ "csky/v2/gcc:arch" ]
modules += [ "csky" ]
} else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
deps = [ "risc-v/riscv32/gcc:arch" ]
modules += [ "risc-v" ]
} else if ("$board" == "esp32") {
deps = [ "xtensa/lx6/gcc:arch" ]
}
}
}
config("public") {
include_dirs = [ "include" ]
if (defined(LOSCFG_ARCH_ARM)) {
include_dirs += [ "arm/include" ]
if (defined(LOSCFG_ARCH_CORTEX_M3)) {
include_dirs += [ "arm/cortex-m3/gcc" ]
} else if (defined(LOSCFG_ARCH_CORTEX_M4)) {
include_dirs += [ "arm/cortex-m4/gcc" ]
} else if (defined(LOSCFG_ARCH_CORTEX_M7)) {
include_dirs += [ "arm/cortex-m7/gcc" ]
} else if (defined(LOSCFG_ARCH_CORTEX_M33)) {
if (defined(LOSCFG_TRUSTZONE)) {
include_dirs += [ "arm/cortex-m33/gcc/TZ/non_secure" ]
} else {
include_dirs += [ "arm/cortex-m33/gcc/NTZ" ]
}
modules += [ "xtensa" ]
}
} else if (defined(LOSCFG_ARCH_RISCV32)) {
include_dirs += [ "risc-v/riscv32/gcc" ]
include_dirs += [ "risc-v/riscv32/gcc/asm" ]
} else if (defined(LOSCFG_ARCH_CSKY)) {
include_dirs += [ "csky/v2/gcc" ]
} else if (defined(LOSCFG_ARCH_XTENSA)) {
include_dirs += [ "xtensa/lx6/gcc" ]
}
configs = [ ":arch_config" ]
}
# 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_m/liteos.gni")
config("arm_config") {
include_dirs = [ "include" ]
}
module_group("arm") {
modules = [ "$board_cpu/gcc" ]
configs = [ ":arm_config" ]
}
......@@ -40,3 +40,7 @@ kernel_module(module_name) {
"reset_vector.S",
]
}
config("public") {
include_dirs = [ "." ]
}
# 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_m/liteos.gni")
module_group("gcc") {
if (defined(LOSCFG_SECURE_TRUSTZONE)) {
modules = [ "TZ" ]
} else {
modules = [ "NTZ" ]
}
}
......@@ -39,3 +39,7 @@ kernel_module(module_name) {
"los_timer.c",
]
}
config("public") {
include_dirs = [ "." ]
}
......@@ -45,3 +45,7 @@ kernel_module(module_name) {
"secure",
]
}
config("public") {
include_dirs = [ "non_secure" ]
}
......@@ -40,3 +40,7 @@ kernel_module(module_name) {
"los_timer.c",
]
}
config("public") {
include_dirs = [ "." ]
}
......@@ -40,3 +40,7 @@ kernel_module(module_name) {
"los_timer.c",
]
}
config("public") {
include_dirs = [ "." ]
}
# 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_m/liteos.gni")
module_group("csky") {
modules = [ "v2/gcc" ]
}
......@@ -39,3 +39,7 @@ kernel_module(module_name) {
"los_timer.c",
]
}
config("public") {
include_dirs = [ "." ]
}
# 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_m/liteos.gni")
module_group("risc-v") {
modules = [ "riscv32/gcc" ]
}
......@@ -38,6 +38,11 @@ kernel_module(module_name) {
"los_interrupt.c",
"los_timer.c",
]
}
include_dirs = [ "asm" ]
config("public") {
include_dirs = [
".",
"asm",
]
}
# 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_m/liteos.gni")
module_group("xtensa") {
modules = [ "lx6/gcc" ]
}
......@@ -40,3 +40,7 @@ kernel_module(module_name) {
"los_window.S",
]
}
config("public") {
include_dirs = [ "." ]
}
......@@ -54,7 +54,7 @@ template("kernel_module") {
auto_config = true
}
cmd = "if grep -q '^\s*config\s*(\s*\"public\"\s*)\s*{\s*\$' $build_gn; then echo true; else echo false; fi"
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)) {
......@@ -65,7 +65,7 @@ template("kernel_module") {
current_dir_name = get_path_info(rebase_path("."), "file")
if (target_name != current_dir_name) {
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 && defined(auto_config)) {
......@@ -142,8 +142,9 @@ set_defaults("kernel_module") {
"$LITEOSTOPDIR:los_config",
]
visibility = [
"$LITEOSTOPDIR/*",
"..:*",
"$LITEOSTOPDIR:*",
":*",
"..:*",
"../..:*",
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册