移动 build.gn 使用的脚本位置 makefile编译时生成src_files.txt
This commit is contained in:
@@ -7,7 +7,7 @@ template("kernel_module") {
|
|||||||
build_gn = rebase_path("BUILD.gn")
|
build_gn = rebase_path("BUILD.gn")
|
||||||
# 如果只存在一个kernel_module,则auto_config=true
|
# 如果只存在一个kernel_module,则auto_config=true
|
||||||
cmd = "grep -c '^\s*\(kernel_module\|hdf_driver\)\s*(\s*\S*\s*)\s*{\s*\$' $build_gn"
|
cmd = "grep -c '^\s*\(kernel_module\|hdf_driver\)\s*(\s*\S*\s*)\s*{\s*\$' $build_gn"
|
||||||
modules_count = exec_script("//build/run_shell_cmd.py", [ cmd ], "value")
|
modules_count = exec_script("//build/python_scripts/run_shell_cmd.py", [ cmd ], "value")
|
||||||
if (modules_count == 1) {
|
if (modules_count == 1) {
|
||||||
auto_config = true
|
auto_config = true
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ template("kernel_module") {
|
|||||||
# 如果不存在config("public")或者module_group,则创建config("public")
|
# 如果不存在config("public")或者module_group,则创建config("public")
|
||||||
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"
|
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 =
|
has_public_config =
|
||||||
exec_script("//build/run_shell_cmd.py", [ cmd ], "value")
|
exec_script("//build/python_scripts/run_shell_cmd.py", [ cmd ], "value")
|
||||||
if (!has_public_config && defined(auto_config)) {
|
if (!has_public_config && defined(auto_config)) {
|
||||||
config("public") {
|
config("public") {
|
||||||
configs = []
|
configs = []
|
||||||
@@ -28,10 +28,9 @@ template("kernel_module") {
|
|||||||
if (target_name != current_dir_name) {
|
if (target_name != current_dir_name) {
|
||||||
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*\(module_group\|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/run_shell_cmd.py", [ cmd ], "value")
|
exec_script("//build/python_scripts/run_shell_cmd.py", [ cmd ], "value")
|
||||||
if (!has_current_dir_group && defined(auto_config)) {
|
if (!has_current_dir_group && defined(auto_config)) {
|
||||||
module_name = target_name
|
module_name = target_name
|
||||||
# print("auto create module $current_dir_name")
|
|
||||||
group(current_dir_name) {
|
group(current_dir_name) {
|
||||||
public_deps = [ ":$module_name" ]
|
public_deps = [ ":$module_name" ]
|
||||||
}
|
}
|
||||||
@@ -53,13 +52,10 @@ template("kernel_module") {
|
|||||||
what = "label_no_toolchain"
|
what = "label_no_toolchain"
|
||||||
if (get_label_info(cfg, what) == get_label_info(":public", what)) {
|
if (get_label_info(cfg, what) == get_label_info(":public", what)) {
|
||||||
included_public_config = true
|
included_public_config = true
|
||||||
print("$current_dir_name, $target_name true")
|
|
||||||
} else {
|
} else {
|
||||||
print("$current_dir_name, $target_name false")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!included_public_config) {
|
if (!included_public_config) {
|
||||||
print("include_public_config")
|
|
||||||
public_configs += [ ":public" ]
|
public_configs += [ ":public" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,8 @@ SRCS += $(foreach dirname, $(SRC_DIRS), $(call GET_SRCS, $(dirname)))
|
|||||||
SRCS += $(EXT_SRC)
|
SRCS += $(EXT_SRC)
|
||||||
# all the obj names
|
# all the obj names
|
||||||
OBJECTS = $(addprefix $(BIN_DIR)/, $(patsubst %.S, %.o, $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(SRCS)))))
|
OBJECTS = $(addprefix $(BIN_DIR)/, $(patsubst %.S, %.o, $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(SRCS)))))
|
||||||
|
|
||||||
|
$(shell echo $(SRCS) > "src_files.txt")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PLATFORM ?= FPGA
|
PLATFORM ?= FPGA
|
||||||
|
Reference in New Issue
Block a user