[klibc] kbuild: let static-y + shared-y depend on lib.a

Sam Ravnborg sam at ravnborg.org
Mon Aug 1 14:35:44 PDT 2005


Introducing this dependency allows us to build a lib.a in a directory
using: lib-y := file.o
And then using EXTRA_USERLDFLAGS we can tell the linker to use this file.

There is no users in klibc atm, but the possibility was so good that
I decided to keep it (developed it for utils/ but decided for a better
solution there).

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

---
commit 5069497d1331ed907edbc1a22155fa8778569f84
tree 16833ccae2ee0f92244b2a4d73d979e7567afbdb
parent e29ea2b12b68a3fb9b548ebdbb52e35c40c25889
author Sam Ravnborg <sam at mars.(none)> Mon, 01 Aug 2005 23:24:08 +0200
committer Sam Ravnborg <sam at mars.(none)> Mon, 01 Aug 2005 23:24:08 +0200

 scripts/Kbuild.klibc |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -207,7 +207,7 @@ cmd_link_o_target = $(if $(strip $(lib-y
 
 $(lib-target): $(lib-y) FORCE
 	$(call if_changed,link_o_target)
-targets += $(lib-target)
+targets += $(lib-target) $(lib-y)
 endif # lib-target
 
 
@@ -234,20 +234,22 @@ link-deps = $(if $($(stripobj)-y), $(cal
 
 quiet_cmd_ld-static = USERLD  $@
       cmd_ld-static = $(USERLD) $(USERLDFLAGS) -o $@      \
+                       $(EXTRA_USERLDFLAGS)               \
                        $(USERCRT0)                        \
                        $(link-deps)                       \
                        $(USERLIBC) $(USERLIBGCC)
 
-$(static-y): $(user-objs) FORCE
+$(static-y): $(user-objs) $(lib-target) FORCE
 	$(call if_changed,ld-static)
 
 quiet_cmd_ld-shared = USERLD  $@
       cmd_ld-shared = $(USERLD) $(USERLDFLAGS) -o $@      \
+                       $(EXTRA_USERLDFLAGS)               \
                        -e main $(USERCRTSHARED)           \
                        $(link-deps)                       \
                        $(USERLIBCSHARED) $(USERLIBGCC)
 		       
-$(shared-y): $(user-objs) FORCE
+$(shared-y): $(user-objs) $(lib-target) FORCE
 	$(call if_changed,ld-shared)
 	
 targets += $(user-real-objs)



More information about the klibc mailing list