tools: iio: Correctly add make dependency for iio_utils
diff mbox series

Message ID 20191018172908.3761-1-labbott@redhat.com
State In Next
Commit 731b60afcb3d318581af7f4e1ac9a66f9e12f1a5
Headers show
Series
  • tools: iio: Correctly add make dependency for iio_utils
Related show

Commit Message

Laura Abbott Oct. 18, 2019, 5:29 p.m. UTC
iio tools fail to build correctly with make parallelization:

$ make -s -j24
fixdep: error opening depfile: ./.iio_utils.o.d: No such file or directory
make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:96: iio_utils.o] Error 2
make: *** [Makefile:43: iio_event_monitor-in.o] Error 2
make: *** Waiting for unfinished jobs....

This is because iio_utils.o is used across multiple targets.
Fix this by making iio_utils.o a proper dependency.

Signed-off-by: Laura Abbott <labbott@redhat.com>
---
I realize that we don't really need the parallelization for tools
because it's so small but when building with the distro we want to use
the same make command and -j wherever possible.

This same issue also appears in the gpio tools so if this looks like an
okay approach I'll fix it there as well.
---
 tools/iio/Build    |  1 +
 tools/iio/Makefile | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Jonathan Cameron Oct. 27, 2019, 4:54 p.m. UTC | #1
On Fri, 18 Oct 2019 13:29:08 -0400
Laura Abbott <labbott@redhat.com> wrote:

> iio tools fail to build correctly with make parallelization:
> 
> $ make -s -j24
> fixdep: error opening depfile: ./.iio_utils.o.d: No such file or directory
> make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:96: iio_utils.o] Error 2
> make: *** [Makefile:43: iio_event_monitor-in.o] Error 2
> make: *** Waiting for unfinished jobs....
> 
> This is because iio_utils.o is used across multiple targets.
> Fix this by making iio_utils.o a proper dependency.
> 
> Signed-off-by: Laura Abbott <labbott@redhat.com>
This looks fine to me, but my Makefile foo is decidedly limited. 
Anyone else want to give a view?

It seems sensible to backport this to stable as it seems low
risk and will avoid some odd issues for distros.

Thanks,

Jonathan
> ---
> I realize that we don't really need the parallelization for tools
> because it's so small but when building with the distro we want to use
> the same make command and -j wherever possible.
> 
> This same issue also appears in the gpio tools so if this looks like an
> okay approach I'll fix it there as well.
> ---
>  tools/iio/Build    |  1 +
>  tools/iio/Makefile | 10 +++++++---
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/iio/Build b/tools/iio/Build
> index f74cbda64710..8d0f3af3723f 100644
> --- a/tools/iio/Build
> +++ b/tools/iio/Build
> @@ -1,3 +1,4 @@
> +iio_utils-y += iio_utils.o
>  lsiio-y += lsiio.o iio_utils.o
>  iio_event_monitor-y += iio_event_monitor.o iio_utils.o
>  iio_generic_buffer-y += iio_generic_buffer.o iio_utils.o
> diff --git a/tools/iio/Makefile b/tools/iio/Makefile
> index e22378dba244..3de763d9ab70 100644
> --- a/tools/iio/Makefile
> +++ b/tools/iio/Makefile
> @@ -32,20 +32,24 @@ $(OUTPUT)include/linux/iio: ../../include/uapi/linux/iio
>  
>  prepare: $(OUTPUT)include/linux/iio
>  
> +IIO_UTILS_IN := $(OUTPUT)iio_utils-in.o
> +$(IIO_UTILS_IN): prepare FORCE
> +	$(Q)$(MAKE) $(build)=iio_utils
> +
>  LSIIO_IN := $(OUTPUT)lsiio-in.o
> -$(LSIIO_IN): prepare FORCE
> +$(LSIIO_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
>  	$(Q)$(MAKE) $(build)=lsiio
>  $(OUTPUT)lsiio: $(LSIIO_IN)
>  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
>  
>  IIO_EVENT_MONITOR_IN := $(OUTPUT)iio_event_monitor-in.o
> -$(IIO_EVENT_MONITOR_IN): prepare FORCE
> +$(IIO_EVENT_MONITOR_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
>  	$(Q)$(MAKE) $(build)=iio_event_monitor
>  $(OUTPUT)iio_event_monitor: $(IIO_EVENT_MONITOR_IN)
>  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
>  
>  IIO_GENERIC_BUFFER_IN := $(OUTPUT)iio_generic_buffer-in.o
> -$(IIO_GENERIC_BUFFER_IN): prepare FORCE
> +$(IIO_GENERIC_BUFFER_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
>  	$(Q)$(MAKE) $(build)=iio_generic_buffer
>  $(OUTPUT)iio_generic_buffer: $(IIO_GENERIC_BUFFER_IN)
>  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
Jonathan Cameron Nov. 10, 2019, 5:12 p.m. UTC | #2
On Sun, 27 Oct 2019 16:54:14 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 18 Oct 2019 13:29:08 -0400
> Laura Abbott <labbott@redhat.com> wrote:
> 
> > iio tools fail to build correctly with make parallelization:
> > 
> > $ make -s -j24
> > fixdep: error opening depfile: ./.iio_utils.o.d: No such file or directory
> > make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:96: iio_utils.o] Error 2
> > make: *** [Makefile:43: iio_event_monitor-in.o] Error 2
> > make: *** Waiting for unfinished jobs....
> > 
> > This is because iio_utils.o is used across multiple targets.
> > Fix this by making iio_utils.o a proper dependency.
> > 
> > Signed-off-by: Laura Abbott <labbott@redhat.com>  
> This looks fine to me, but my Makefile foo is decidedly limited. 
> Anyone else want to give a view?
> 
> It seems sensible to backport this to stable as it seems low
> risk and will avoid some odd issues for distros.
I've applied it to the togreg branch of iio.git for now. We can
request a stable backport once it's in mainline.  It might
make the coming merge window if Linus suggest we are looking
at an rc8.

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> > ---
> > I realize that we don't really need the parallelization for tools
> > because it's so small but when building with the distro we want to use
> > the same make command and -j wherever possible.
> > 
> > This same issue also appears in the gpio tools so if this looks like an
> > okay approach I'll fix it there as well.
> > ---
> >  tools/iio/Build    |  1 +
> >  tools/iio/Makefile | 10 +++++++---
> >  2 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/iio/Build b/tools/iio/Build
> > index f74cbda64710..8d0f3af3723f 100644
> > --- a/tools/iio/Build
> > +++ b/tools/iio/Build
> > @@ -1,3 +1,4 @@
> > +iio_utils-y += iio_utils.o
> >  lsiio-y += lsiio.o iio_utils.o
> >  iio_event_monitor-y += iio_event_monitor.o iio_utils.o
> >  iio_generic_buffer-y += iio_generic_buffer.o iio_utils.o
> > diff --git a/tools/iio/Makefile b/tools/iio/Makefile
> > index e22378dba244..3de763d9ab70 100644
> > --- a/tools/iio/Makefile
> > +++ b/tools/iio/Makefile
> > @@ -32,20 +32,24 @@ $(OUTPUT)include/linux/iio: ../../include/uapi/linux/iio
> >  
> >  prepare: $(OUTPUT)include/linux/iio
> >  
> > +IIO_UTILS_IN := $(OUTPUT)iio_utils-in.o
> > +$(IIO_UTILS_IN): prepare FORCE
> > +	$(Q)$(MAKE) $(build)=iio_utils
> > +
> >  LSIIO_IN := $(OUTPUT)lsiio-in.o
> > -$(LSIIO_IN): prepare FORCE
> > +$(LSIIO_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
> >  	$(Q)$(MAKE) $(build)=lsiio
> >  $(OUTPUT)lsiio: $(LSIIO_IN)
> >  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
> >  
> >  IIO_EVENT_MONITOR_IN := $(OUTPUT)iio_event_monitor-in.o
> > -$(IIO_EVENT_MONITOR_IN): prepare FORCE
> > +$(IIO_EVENT_MONITOR_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
> >  	$(Q)$(MAKE) $(build)=iio_event_monitor
> >  $(OUTPUT)iio_event_monitor: $(IIO_EVENT_MONITOR_IN)
> >  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
> >  
> >  IIO_GENERIC_BUFFER_IN := $(OUTPUT)iio_generic_buffer-in.o
> > -$(IIO_GENERIC_BUFFER_IN): prepare FORCE
> > +$(IIO_GENERIC_BUFFER_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
> >  	$(Q)$(MAKE) $(build)=iio_generic_buffer
> >  $(OUTPUT)iio_generic_buffer: $(IIO_GENERIC_BUFFER_IN)
> >  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@  
>

Patch
diff mbox series

diff --git a/tools/iio/Build b/tools/iio/Build
index f74cbda64710..8d0f3af3723f 100644
--- a/tools/iio/Build
+++ b/tools/iio/Build
@@ -1,3 +1,4 @@ 
+iio_utils-y += iio_utils.o
 lsiio-y += lsiio.o iio_utils.o
 iio_event_monitor-y += iio_event_monitor.o iio_utils.o
 iio_generic_buffer-y += iio_generic_buffer.o iio_utils.o
diff --git a/tools/iio/Makefile b/tools/iio/Makefile
index e22378dba244..3de763d9ab70 100644
--- a/tools/iio/Makefile
+++ b/tools/iio/Makefile
@@ -32,20 +32,24 @@  $(OUTPUT)include/linux/iio: ../../include/uapi/linux/iio
 
 prepare: $(OUTPUT)include/linux/iio
 
+IIO_UTILS_IN := $(OUTPUT)iio_utils-in.o
+$(IIO_UTILS_IN): prepare FORCE
+	$(Q)$(MAKE) $(build)=iio_utils
+
 LSIIO_IN := $(OUTPUT)lsiio-in.o
-$(LSIIO_IN): prepare FORCE
+$(LSIIO_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
 	$(Q)$(MAKE) $(build)=lsiio
 $(OUTPUT)lsiio: $(LSIIO_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
 
 IIO_EVENT_MONITOR_IN := $(OUTPUT)iio_event_monitor-in.o
-$(IIO_EVENT_MONITOR_IN): prepare FORCE
+$(IIO_EVENT_MONITOR_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
 	$(Q)$(MAKE) $(build)=iio_event_monitor
 $(OUTPUT)iio_event_monitor: $(IIO_EVENT_MONITOR_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
 
 IIO_GENERIC_BUFFER_IN := $(OUTPUT)iio_generic_buffer-in.o
-$(IIO_GENERIC_BUFFER_IN): prepare FORCE
+$(IIO_GENERIC_BUFFER_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
 	$(Q)$(MAKE) $(build)=iio_generic_buffer
 $(OUTPUT)iio_generic_buffer: $(IIO_GENERIC_BUFFER_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@