diff mbox series

[v2,7/7] meson: merge hw_common_arch in target_common_system_arch

Message ID 20250521223414.248276-8-pierrick.bouvier@linaro.org
State New
Headers show
Series single-binary: build target common libraries with dependencies | expand

Commit Message

Pierrick Bouvier May 21, 2025, 10:34 p.m. UTC
No need to keep two different libraries, as both are compiled with exact
same flags. As well, rename target common libraries to common_{arch} and
system_{arch}, to follow what exists for common and system libraries.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 meson.build | 33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 087ce7dd20d..f57b051b3d4 100644
--- a/meson.build
+++ b/meson.build
@@ -4121,7 +4121,6 @@  common_all = static_library('common',
                             dependencies: common_ss.all_dependencies())
 
 # construct common libraries per base architecture
-hw_common_arch_libs = {}
 target_common_arch_libs = {}
 target_common_system_arch_libs = {}
 foreach target_base_arch, config_base_arch : config_base_arch_mak
@@ -4150,22 +4149,10 @@  foreach target_base_arch, config_base_arch : config_base_arch_mak
   target_c_args = ['-DCPU_DEFS_H']
   target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
 
-  if target_base_arch in hw_common_arch
-    src = hw_common_arch[target_base_arch]
-    lib = static_library(
-      'hw_' + target_base_arch,
-      build_by_default: false,
-      sources: src.all_sources() + genh,
-      include_directories: inc,
-      c_args: target_system_c_args,
-      dependencies: src.all_dependencies() + common_deps + system_deps)
-    hw_common_arch_libs += {target_base_arch: lib}
-  endif
-
   if target_base_arch in target_common_arch
     src = target_common_arch[target_base_arch]
     lib = static_library(
-      'target_' + target_base_arch,
+      'common_' + target_base_arch,
       build_by_default: false,
       sources: src.all_sources() + genh,
       include_directories: inc,
@@ -4175,10 +4162,20 @@  foreach target_base_arch, config_base_arch : config_base_arch_mak
     target_common_arch_libs += {target_base_arch: lib}
   endif
 
+  # merge hw_common_arch in target_common_system_arch
+  if target_base_arch in hw_common_arch
+    hw_src = hw_common_arch[target_base_arch]
+    if target_base_arch in target_common_system_arch
+      target_common_system_arch[target_base_arch].add_all(hw_src)
+    else
+      target_common_system_arch += {target_base_arch: hw_src}
+    endif
+  endif
+
   if target_base_arch in target_common_system_arch
     src = target_common_system_arch[target_base_arch]
     lib = static_library(
-      'target_system_' + target_base_arch,
+      'system_' + target_base_arch,
       build_by_default: false,
       sources: src.all_sources() + genh,
       include_directories: inc,
@@ -4373,12 +4370,6 @@  foreach target : target_dirs
     objects += libuser.extract_objects(src.sources())
     arch_deps += src.dependencies()
   endif
-  if target_type == 'system' and target_base_arch in hw_common_arch_libs
-    src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
-    lib = hw_common_arch_libs[target_base_arch]
-    objects += lib.extract_objects(src.sources())
-    arch_deps += src.dependencies()
-  endif
   if target_type == 'system' and target_base_arch in target_common_system_arch_libs
     src = target_common_system_arch[target_base_arch].apply(config_target, strict: false)
     lib = target_common_system_arch_libs[target_base_arch]