Re: [PATCH] Makefile: add version.h dependency on all objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 27, 2021 at 11:58:56AM -0500, Kyle Russell wrote:
> This guarantees the generated version.h will exist before attempting
> to compile any c files that include it.
> 
> Several source files include the generated version.h, but not all
> declare a proper make dependency.
> 
> $ grep -r 'version\.h' *.c
> compile-i386.c:#include "version.h"
> lib.c:#include "version.h"
> options.c:#include "version.h"
> 
> This allows a sufficiently parallelized make invocation to encounter
> ENOENT.
> 
>   CC      compile-i386.o
> compile-i386.c:60:21: fatal error: version.h: No such file or directory
> compilation terminated.
> Makefile:253: recipe for target 'compile-i386.o' failed
> make: *** [compile-i386.o] Error 1


Mmmm, yes. I never see this because I always use a plain 'make -j'.
Thanks.

> @@ -249,7 +249,7 @@ libsparse.a: $(LIB_OBJS)
>  cflags   += $($(*)-cflags) $(CPPFLAGS) $(CFLAGS)
> -%.o: %.c
> +%.o: %.c version.h

This is annoying because now all files need to be rebuild at every changes.
I've modified the patch so that single new file (version.c) includes and
depends on the generated file.

Best regards,
-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux