[klibc] [PATCH] klibc: relink klibc programs when klibc library is changed

Sam Ravnborg sam at ravnborg.org
Tue Apr 11 13:21:12 PDT 2006


Add klibc libraries as prerequisites so we relink klibc
programs when klibc changes.
We need to avoid rebuilding the libraries when we do not build klibc
so added a special rule that are only active when we do not build klibc
to avoid klibc libraries to be updated.

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
---

diff --git a/klibc/Kbuild b/klibc/Kbuild
index 03e7102..f422d9d 100644
--- a/klibc/Kbuild
+++ b/klibc/Kbuild
@@ -2,6 +2,9 @@ #
 # Kbuild file for klibc
 #
 
+# Tell that we are building klibc
+klibc-build := y
+
 libc-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \
 	  asprintf.o vasprintf.o \
 	  vsscanf.o sscanf.o ctypes.o \
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 7ee7324..14aeccc 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -257,7 +257,7 @@ quiet_cmd_ld-static = KLIBCLD $@
                        $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@
 
 
-$(static-y): $(klibc-objs) $(lib-target) FORCE
+$(static-y): $(klibc-objs) $(lib-target) $(KLIBCCRT0) $(KLIBCLIBC) FORCE
 	$(call if_changed,ld-static)
 
 quiet_cmd_ld-shared = KLIBCLD $@
@@ -270,8 +270,17 @@ quiet_cmd_ld-shared = KLIBCLD $@
                        $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@
 
 
-$(shared-y): $(klibc-objs) $(lib-target) FORCE
+$(shared-y): $(klibc-objs) $(lib-target) $(KLIBCCRTSHARED) \
+                                         $(KLIBCLIBCSHARED) FORCE
 	$(call if_changed,ld-shared)
+
+# Do not try to build KLIBC libaries if we are building klibc
+ifeq ($(klibc-build),)
+$(KLIBCCRT0) $(KLIBCLIBC):
+	echo fisk
+$(KLIBCCRTSHARED) $(KLIBCLIBCSHARED):
+	echo fisk
+endif
 
 targets += $(klibc-real-objs)
 endif



More information about the klibc mailing list