[Concept,14/18] ulib: Makefile: Plumb in creation of the API header

Message ID 20250909151824.2327219-15-sjg@u-boot.org
State New
Headers
Series ulib: Complete initial U-Boot library |

Commit Message

Simon Glass Sept. 9, 2025, 3:18 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Plumb in generation of the u-boot-api.h file, containing renamed symbols
for inclusion by the program being linked with ulib.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 Makefile | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Patch

diff --git a/Makefile b/Makefile
index f157de21008..c4a5dbea199 100644
--- a/Makefile
+++ b/Makefile
@@ -1902,6 +1902,16 @@  quiet_cmd_libu-boot.a = AR      $@
 libu-boot.a: .ulib-objs include/u-boot-api.h FORCE
 	$(call if_changed,libu-boot.a)
 
+# Generate API header with renamed function declarations
+quiet_cmd_u-boot-api.h = APIH    $@
+      cmd_u-boot-api.h = $(PYTHON3) $(srctree)/scripts/build_api.py \
+		$(srctree)/lib/ulib/rename.syms --api $@ \
+		--include-dir $(srctree)/include
+
+include/u-boot-api.h: $(srctree)/lib/ulib/rename.syms \
+		$(srctree)/scripts/build_api.py FORCE
+	$(call if_changed,u-boot-api.h)
+
 # Build ulib_test that links with shared library
 quiet_cmd_ulib_test = HOSTCC  $@
       cmd_ulib_test = $(HOSTCC) $(HOSTCFLAGS) \
@@ -2343,7 +2353,8 @@  CLEAN_FILES += include/autoconf.mk* include/bmp_logo.h include/bmp_logo_data.h \
 	       Test* capsule*.*.efi-capsule capsule*.map \
 	       test/ulib/ulib_test test/ulib/ulib_test_static \
 	       libu-boot.so.tmp libu-boot.so.objlist \
-	       libu-boot.a.tmp libu-boot.a.objlist
+	       libu-boot.a.tmp libu-boot.a.objlist \
+	       include/u-boot-api.h
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl vpl \