[Concept,04/13] ulib: Make shared-lib deps conditional on ULIB_SHARED_LIB

Message ID 20260214021317.816170-5-sjg@u-boot.org
State New
Headers
Series ulib: Support building examples for x86 |

Commit Message

Simon Glass Feb. 14, 2026, 2:12 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The examples_ulib and examples_rust targets unconditionally depend on
libu-boot.so, which is only buildable on sandbox (ULIB_SHARED_LIB
depends on SANDBOX). Make the dependency conditional on
CONFIG_ULIB_SHARED_LIB so the targets can also be built on other
architectures such as x86.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/Makefile b/Makefile
index 263914b3757..26ecf59a98a 100644
--- a/Makefile
+++ b/Makefile
@@ -1961,7 +1961,7 @@  test/ulib/ulib_test_static: test/ulib/ulib_test.o libu-boot.a \
 
 # abspath is used since many paths are relative
 PHONY += examples_ulib
-examples_ulib: libu-boot.a libu-boot.so FORCE
+examples_ulib: libu-boot.a $(if $(CONFIG_ULIB_SHARED_LIB),libu-boot.so) FORCE
 	$(Q)$(MAKE) -C $(srctree)/examples/ulib \
 		UBOOT_BUILD=$(abspath $(obj)) \
 		EXAMPLE_DIR=. \
@@ -1973,7 +1973,7 @@  examples_ulib: libu-boot.a libu-boot.so FORCE
 		LIB_STATIC_LDS="$(abspath $(LIB_STATIC_LDS))"
 
 PHONY += examples_rust
-examples_rust: libu-boot.a libu-boot.so FORCE
+examples_rust: libu-boot.a $(if $(CONFIG_ULIB_SHARED_LIB),libu-boot.so) FORCE
 	@if command -v cargo >/dev/null 2>&1; then \
 		$(MAKE) -C $(srctree)/examples/rust \
 			UBOOT_BUILD=$(abspath $(obj)) \