[PATCH] drm/xe: avoid using 'grouped targets' in Makefile

Lucas De Marchi lucas.demarchi at intel.com
Tue Feb 20 14:33:14 UTC 2024


On Tue, Feb 20, 2024 at 09:08:42AM -0300, Gustavo Sousa wrote:
>Quoting Lucas De Marchi (2024-02-20 02:44:57-03:00)
>>On Mon, Feb 19, 2024 at 03:58:45PM +0200, Dafna Hirschfeld wrote:
>>>The feature 'grouped target' ('&:') in makefiles is only added in 'make'
>>>version 4.3. This cause problems in older version of 'make'.
>>>(Specifically $(@D) is wrongly interpreted - it creates 'generated' dir
>>>in the source path instead of the build path).
>>>Avoid this feature.
>>
>>but it was used for a reason since a single invocation is supposed to
>>generate both the .c and .h from a single invocation. AFAIR when
>>implementing this, not using grouped target would be a mix and match on
>>having a succesfull build. Does removing it really work with incremental
>>and parallel build?
>
>FWIW, the root Makefile does what it calls a "multi-target pattern rule"
>trick to get the same behavior.

cool... TIL https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html

	Multiple target patterns in pattern rules are always treated as grouped
	targets (see Multiple Targets in a Rule) regardless of whether they use
	the : or &: separator.

So 

-$(generated_oob) &: $(obj)/xe_gen_wa_oob $(srctree)/$(src)/xe_wa_oob.rules
+%/generated/xe_wa_oob.c %/generated/xe_wa_oob.h: $(obj)/xe_gen_wa_oob $(srctree)/$(src)/xe_wa_oob.rules

has the same effect and the rule is called only once.
Dafna, can you update the patch to use this trick?

thanks
Lucas De Marchi

>
>--
>Gustavo
>
>>
>>Lucas De Marchi


More information about the Intel-xe mailing list