On 16.02.2024 11:51, Roger Pau Monné wrote:
> On Fri, Feb 16, 2024 at 11:04:46AM +0100, Jan Beulich wrote:
>> On 15.02.2024 18:23, Roger Pau Monné wrote:
>>> On Thu, Feb 15, 2024 at 05:22:00PM +0100, Jan Beulich wrote:
>>>> On 15.02.2024 17:08, Roger Pau Monné wrote:
>>>>> On Thu, Feb 15, 2024 at 02:02:41PM +0100, Jan Beulich wrote:
>>>>>> --- a/xen/Rules.mk
>>>>>> +++ b/xen/Rules.mk
>>>>>> @@ -15,7 +15,11 @@ srcdir := $(srctree)/$(src)
>>>>>>  PHONY := __build
>>>>>>  __build:
>>>>>>  
>>>>>> --include $(objtree)/include/config/auto.conf
>>>>>> +ifneq ($(obj),tools)
>>>>>> +ifneq ($(obj),tools/kconfig)
>>>>>> +include $(objtree)/include/config/auto.conf
>>>>>> +endif
>>>>>> +endif
>>>>>
>>>>> Trying to understand this, I assume it's to avoid an infinite
>>>>> dependency loop that generating include/config/auto.conf requires some
>>>>> tools that are build using xen/Rules.mk?
>>>>
>>>> The file has dependencies only in xen/Makefile. This is about the
>>>> file simply not being there when initially building. Perhaps the
>>>> patch description helps that I've written in the meantime:
>>>>
>>>> "Because of using "-include", failure to (re)build auto.conf (with
>>>>  auto.conf.cmd produced as a secondary target) won't stop make from
>>>>  continuing the build. Arrange for it being possible to drop the - from
>>>>  Rules.mk, requiring that the include be skipped for tools-only targets.
>>>
>>> Wouldn't it be more reliable if we skipped the include for any paths
>>> in $(obj) that start with 'tools', rather than hardcoding 'tools' and
>>> 'tools/kconfig'?
>>
>> I was first meaning to do so, but the expression would end up more
>> complex than I'd like (for it needing to be an exact match of "tools"
>> and a prefix match of "tools/"). Thinking of it,
>>
>> ifneq ($(obj),tools)
>> ifneq ($(patsubst tools/%,$(obj)),)
>>
>> might do (and not be as complex as I first thought, when intending to
>> put all in a single "if").
> 
> Would something like the rune below work?
> 
> ifneq ($(word 1, $(subst /, ,$(obj))),tools)
> 
> That should allow to have a single condition, and should match both
> 'tools' and 'tools/*'

Hmm, yes, that works. $(subst ...) is something I usually try to avoid,
in favor of $(patsubst ...).

Jan

Reply via email to