[PATCH 08/11] scripts/Makefile: implement targetprogs-y

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 27 02:47:39 EDT 2013


using obj-y for targetprogs only works until only a single program
is compiled. Adding the second one will end up in the linker trying
to link both together.

Add targetprogs-y to fix this.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 scripts/Makefile | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index 99a06b0..adc786e 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -32,9 +32,12 @@ subdir-	+= basic kconfig setupmbr
 quiet_cmd_csingle	= CC      $@
       cmd_csingle	= $(CC) -Wp,-MD,$(depfile) $(CFLAGS) -o $@ $<
 
-obj-$(CONFIG_BAREBOXENV_TARGET)	+= bareboxenv-target
+__targetprogs	:= $(sort $(targetprogs-y) $(targetprogs-m))
+target-csingle	:= $(foreach m,$(__targetprogs),$(if $($(m)-objs),,$(m)))
+__targetprogs	:= $(addprefix $(obj)/,$(__targetprogs))
+target-csingle	:= $(addprefix $(obj)/,$(target-csingle))
 
-scripts/bareboxenv-target: scripts/bareboxenv.c FORCE
-	$(call if_changed_dep,csingle)
+always		:= $(hostprogs-y) $(hostprogs-m) $(targetprogs-y)
 
-always		:= $(hostprogs-y) $(hostprogs-m)
+$(target-csingle): %-target: %.c FORCE
+	$(call if_changed_dep,csingle)
-- 
1.8.4.rc3




More information about the barebox mailing list