From f790b7f9d45c4e364a691edf18ea5df6ed07479a Mon Sep 17 00:00:00 2001 From: andy <1414772332@qq.com> Date: Fri, 17 Jan 2025 17:21:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=20build.gn=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E8=84=9A=E6=9C=AC=E4=BD=8D=E7=BD=AE=20makefi?= =?UTF-8?q?le=E7=BC=96=E8=AF=91=E6=97=B6=E7=94=9F=E6=88=90src=5Ffiles.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/buildcfg.gni | 10 +++------- build/makefile.cfg | 2 ++ build/{ => python_scripts}/run_shell_cmd.py | 0 3 files changed, 5 insertions(+), 7 deletions(-) rename build/{ => python_scripts}/run_shell_cmd.py (100%) diff --git a/build/buildcfg.gni b/build/buildcfg.gni index eb5d931..530e1ba 100644 --- a/build/buildcfg.gni +++ b/build/buildcfg.gni @@ -7,7 +7,7 @@ template("kernel_module") { build_gn = rebase_path("BUILD.gn") # 如果只存在一个kernel_module,则auto_config=true 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) { auto_config = true } @@ -15,7 +15,7 @@ template("kernel_module") { # 如果不存在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" 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)) { config("public") { configs = [] @@ -28,10 +28,9 @@ template("kernel_module") { 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" 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)) { module_name = target_name - # print("auto create module $current_dir_name") group(current_dir_name) { public_deps = [ ":$module_name" ] } @@ -53,13 +52,10 @@ template("kernel_module") { what = "label_no_toolchain" if (get_label_info(cfg, what) == get_label_info(":public", what)) { included_public_config = true - print("$current_dir_name, $target_name true") } else { - print("$current_dir_name, $target_name false") } } if (!included_public_config) { - print("include_public_config") public_configs += [ ":public" ] } } diff --git a/build/makefile.cfg b/build/makefile.cfg index 5396a35..02e1e8b 100644 --- a/build/makefile.cfg +++ b/build/makefile.cfg @@ -83,6 +83,8 @@ SRCS += $(foreach dirname, $(SRC_DIRS), $(call GET_SRCS, $(dirname))) SRCS += $(EXT_SRC) # all the obj names OBJECTS = $(addprefix $(BIN_DIR)/, $(patsubst %.S, %.o, $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(SRCS))))) + +$(shell echo $(SRCS) > "src_files.txt") endif PLATFORM ?= FPGA diff --git a/build/run_shell_cmd.py b/build/python_scripts/run_shell_cmd.py similarity index 100% rename from build/run_shell_cmd.py rename to build/python_scripts/run_shell_cmd.py