osmith submitted this change.
gen_makefile: --targets: fix subdir projects
Some projects are in subdirectories of git repositories, such as
simtrace2_host, or osmocom-bb_layer23. When filtering the targets to be
added to the Makefile, we must also add the main projects of such
projects in subdirectories, so Makefile rules like the following work:
.make.simtrace2_host.clone: .make.simtrace2.clone
Fix for:
make: *** No rule to make target '.make.simtrace2.clone', needed by '.make.simtrace2_host.clone'. Stop.
Fixes: 1d13c9d7 ("gen_makefile: add --targets")
Change-Id: I136f0d9cd982653b109005aeb35885b6f015eec8
---
M gen_makefile.py
M tests/test_gen_makefile.py
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/gen_makefile.py b/gen_makefile.py
index 4730c59..3885e10 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -243,6 +243,12 @@
print()
sys.exit(1)
+ # simtrace2_host -> simtrace2
+ if "_" in project:
+ project_main = project.split("_")[0]
+ if project_main in projects_deps and project_main not in ret:
+ queue += [project_main]
+
deps = projects_deps[project]
ret[project] = deps
diff --git a/tests/test_gen_makefile.py b/tests/test_gen_makefile.py
index 6232003..622f6e7 100644
--- a/tests/test_gen_makefile.py
+++ b/tests/test_gen_makefile.py
@@ -67,10 +67,11 @@
def test_gen_makefile_with_targets_arg(tmp_path):
- run_cmd(["./gen_makefile.py", "-m", tmp_path, "--targets", "trxcon,osmo-mgw"], cwd=osmo_dev_path)
+ run_cmd(["./gen_makefile.py", "-m", tmp_path, "--targets", "trxcon,osmo-mgw,simtrace2_host"], cwd=osmo_dev_path)
run_cmd("grep -q '^osmocom-bb_trxcon_files :=' Makefile", cwd=tmp_path, shell=True)
run_cmd("grep -q '^osmo-mgw_files :=' Makefile", cwd=tmp_path, shell=True)
run_cmd("grep -q '^libosmocore_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_cmd("grep -q '^simtrace2_files :=' Makefile", cwd=tmp_path, shell=True)
run_cmd("! grep -q '^osmo-bts_files :=' Makefile", cwd=tmp_path, shell=True)
run_cmd("! grep -q '^osmo-s1gw_files :=' Makefile", cwd=tmp_path, shell=True)
run_cmd("! grep -q '^open5gs_files :=' Makefile", cwd=tmp_path, shell=True)
To view, visit change 40978. To unsubscribe, or for help writing mail filters, visit settings.