aboutsummaryrefslogtreecommitdiff
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/Makefile.build17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5eac45f91..cd5592b34 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -254,11 +254,28 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
254# 254#
255ifdef builtin-target 255ifdef builtin-target
256quiet_cmd_link_o_target = LD $@ 256quiet_cmd_link_o_target = LD $@
257ifeq ($(CONFIG_PLATFORM_POSIX),y)
257# If the list of objects to link is empty, just create an empty built-in.o 258# If the list of objects to link is empty, just create an empty built-in.o
258# -nostdlib is added to make "make LD=gcc ..." work (some people use that) 259# -nostdlib is added to make "make LD=gcc ..." work (some people use that)
259cmd_link_o_target = $(if $(strip $(obj-y)),\ 260cmd_link_o_target = $(if $(strip $(obj-y)),\
260 $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ 261 $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
261 rm -f $@; $(AR) rcs $@) 262 rm -f $@; $(AR) rcs $@)
263else
264# In default builds of busybox-w32 all builtin targets have either
265# zero or one object files. In the latter case copy the object to
266# the target. This avoids the need to use the linker: the llvm
267# linker doesn't support the -r option.
268ifeq ($(words $(obj-y)),0)
269cmd_link_o_target = rm -f $@; $(AR) rcs $@
270else
271ifeq ($(words $(obj-y)),1)
272cmd_link_o_target = cp $(obj-y) $@
273else
274cmd_link_o_target = \
275 $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^))
276endif
277endif
278endif
262 279
263$(builtin-target): $(obj-y) FORCE 280$(builtin-target): $(obj-y) FORCE
264 $(call if_changed,link_o_target) 281 $(call if_changed,link_o_target)