Re: [PATCH] Makefile: dedup git-ls-files output to prevent duplicate targets

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

 



Jiang Xin <worldhello.net@xxxxxxxxx> writes:

>>         )
>> -FOUND_SOURCE_FILES := $(shell $(SOURCES_CMD))
>> +FOUND_SOURCE_FILES := $(sort $(shell $(SOURCES_CMD)))
>>
>>  FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
>>  FOUND_H_SOURCES = $(filter %.h,$(FOUND_SOURCE_FILES))
>>
>
> If I disabled the git-ls-files command like below,
>
>     @@ -846,7 +846,7 @@ generated-hdrs: $(GENERATED_H)
>...
> This is because the three generated header files (defined in
> $(GENERATED_H)) are also included in the result of "SOURCES_CMD". We
> can fix this by sorting LOCALIZED_C:
>
>     -LOCALIZED_C = $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(SCALAR_SOURCES) \
>     -             $(GENERATED_H)
>     +LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES)
> $(SCALAR_SOURCES) \
>     +               $(GENERATED_H))

If you make FOUND_SOURCE_FILES unique upfront, the at least there
wouldn't be any duplicates there.  Do you mean that some of what is
in FOUND_SOURCE_FILES appear in either SCALAR_SOURCES or GENERATED_H?

If not, I think deduplicating near the source of the issue, i.e.

  FOUND_SOURCE_FILES := $(sort $(shell $(SOURCES_CMD)))

may be sufficient.  Deduplicating near the consumer, like
LOCALIZED_C, may force us to dedup all the consumers of it (e.g.
LOCALIZED_C is not the sole consumer of FOUND_C_SOURCES; you'd need
to sort the input to COCCI_SOURCES, for example).

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux