tools: gpio: Correctly add make dependencies for gpio_utils
diff mbox series

Message ID 20191112221026.5859-1-labbott@redhat.com
State New
Headers show
Series
  • tools: gpio: Correctly add make dependencies for gpio_utils
Related show

Commit Message

Laura Abbott Nov. 12, 2019, 10:10 p.m. UTC
gpio tools fail to build correctly with make parallelization:

$ make -s -j24
ld: gpio-utils.o: file not recognized: file truncated
make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:145: lsgpio-in.o] Error 1
make: *** [Makefile:43: lsgpio-in.o] Error 2
make: *** Waiting for unfinished jobs....

This is because gpio-utils.o is used across multiple targets.
Fix this by making gpio-utios.o a proper dependency.

Signed-off-by: Laura Abbott <labbott@redhat.com>
---
I made a similar fix to iio tools
lore.kernel.org/r/20191018172908.3761-1-labbott@redhat.com
---
 tools/gpio/Build    |  1 +
 tools/gpio/Makefile | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Bartosz Golaszewski Nov. 13, 2019, 12:47 p.m. UTC | #1
wt., 12 lis 2019 o 23:10 Laura Abbott <labbott@redhat.com> napisaƂ(a):
>
>
> gpio tools fail to build correctly with make parallelization:
>
> $ make -s -j24
> ld: gpio-utils.o: file not recognized: file truncated
> make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:145: lsgpio-in.o] Error 1
> make: *** [Makefile:43: lsgpio-in.o] Error 2
> make: *** Waiting for unfinished jobs....
>
> This is because gpio-utils.o is used across multiple targets.
> Fix this by making gpio-utios.o a proper dependency.
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>
> ---
> I made a similar fix to iio tools
> lore.kernel.org/r/20191018172908.3761-1-labbott@redhat.com
> ---
>  tools/gpio/Build    |  1 +
>  tools/gpio/Makefile | 10 +++++++---
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/tools/gpio/Build b/tools/gpio/Build
> index 620c1937d957..4141f35837db 100644
> --- a/tools/gpio/Build
> +++ b/tools/gpio/Build
> @@ -1,3 +1,4 @@
> +gpio-utils-y += gpio-utils.o
>  lsgpio-y += lsgpio.o gpio-utils.o
>  gpio-hammer-y += gpio-hammer.o gpio-utils.o
>  gpio-event-mon-y += gpio-event-mon.o gpio-utils.o
> diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
> index 1178d302757e..6080de58861f 100644
> --- a/tools/gpio/Makefile
> +++ b/tools/gpio/Makefile
> @@ -35,11 +35,15 @@ $(OUTPUT)include/linux/gpio.h: ../../include/uapi/linux/gpio.h
>
>  prepare: $(OUTPUT)include/linux/gpio.h
>
> +GPIO_UTILS_IN := $(output)gpio-utils-in.o
> +$(GPIO_UTILS_IN): prepare FORCE
> +       $(Q)$(MAKE) $(build)=gpio-utils
> +
>  #
>  # lsgpio
>  #
>  LSGPIO_IN := $(OUTPUT)lsgpio-in.o
> -$(LSGPIO_IN): prepare FORCE
> +$(LSGPIO_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o
>         $(Q)$(MAKE) $(build)=lsgpio
>  $(OUTPUT)lsgpio: $(LSGPIO_IN)
>         $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
> @@ -48,7 +52,7 @@ $(OUTPUT)lsgpio: $(LSGPIO_IN)
>  # gpio-hammer
>  #
>  GPIO_HAMMER_IN := $(OUTPUT)gpio-hammer-in.o
> -$(GPIO_HAMMER_IN): prepare FORCE
> +$(GPIO_HAMMER_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o
>         $(Q)$(MAKE) $(build)=gpio-hammer
>  $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN)
>         $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
> @@ -57,7 +61,7 @@ $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN)
>  # gpio-event-mon
>  #
>  GPIO_EVENT_MON_IN := $(OUTPUT)gpio-event-mon-in.o
> -$(GPIO_EVENT_MON_IN): prepare FORCE
> +$(GPIO_EVENT_MON_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o
>         $(Q)$(MAKE) $(build)=gpio-event-mon
>  $(OUTPUT)gpio-event-mon: $(GPIO_EVENT_MON_IN)
>         $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
> --
> 2.21.0
>

Applied for fixes, thanks!

Bartosz

Patch
diff mbox series

diff --git a/tools/gpio/Build b/tools/gpio/Build
index 620c1937d957..4141f35837db 100644
--- a/tools/gpio/Build
+++ b/tools/gpio/Build
@@ -1,3 +1,4 @@ 
+gpio-utils-y += gpio-utils.o
 lsgpio-y += lsgpio.o gpio-utils.o
 gpio-hammer-y += gpio-hammer.o gpio-utils.o
 gpio-event-mon-y += gpio-event-mon.o gpio-utils.o
diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
index 1178d302757e..6080de58861f 100644
--- a/tools/gpio/Makefile
+++ b/tools/gpio/Makefile
@@ -35,11 +35,15 @@  $(OUTPUT)include/linux/gpio.h: ../../include/uapi/linux/gpio.h
 
 prepare: $(OUTPUT)include/linux/gpio.h
 
+GPIO_UTILS_IN := $(output)gpio-utils-in.o
+$(GPIO_UTILS_IN): prepare FORCE
+	$(Q)$(MAKE) $(build)=gpio-utils
+
 #
 # lsgpio
 #
 LSGPIO_IN := $(OUTPUT)lsgpio-in.o
-$(LSGPIO_IN): prepare FORCE
+$(LSGPIO_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o
 	$(Q)$(MAKE) $(build)=lsgpio
 $(OUTPUT)lsgpio: $(LSGPIO_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
@@ -48,7 +52,7 @@  $(OUTPUT)lsgpio: $(LSGPIO_IN)
 # gpio-hammer
 #
 GPIO_HAMMER_IN := $(OUTPUT)gpio-hammer-in.o
-$(GPIO_HAMMER_IN): prepare FORCE
+$(GPIO_HAMMER_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o
 	$(Q)$(MAKE) $(build)=gpio-hammer
 $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
@@ -57,7 +61,7 @@  $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN)
 # gpio-event-mon
 #
 GPIO_EVENT_MON_IN := $(OUTPUT)gpio-event-mon-in.o
-$(GPIO_EVENT_MON_IN): prepare FORCE
+$(GPIO_EVENT_MON_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o
 	$(Q)$(MAKE) $(build)=gpio-event-mon
 $(OUTPUT)gpio-event-mon: $(GPIO_EVENT_MON_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@