|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen: add header guards to generated asm generic headers
On 06.06.2025 02:07, Stefano Stabellini wrote:
> On Thu, 5 Jun 2025, Jan Beulich wrote:
>> On 05.06.2025 01:09, Stefano Stabellini wrote:
>>> --- a/xen/scripts/Makefile.asm-generic
>>> +++ b/xen/scripts/Makefile.asm-generic
>>> @@ -32,7 +32,12 @@ old-headers := $(wildcard $(obj)/*.h)
>>> unwanted := $(filter-out $(generic-y) $(generated-y),$(old-headers))
>>>
>>> quiet_cmd_wrap = WRAP $@
>>> - cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
>>> + cmd_wrap = \
>>> + upper=$$(echo $*.h | tr a-z A-Z | tr '/.' '__'); \
>>> + printf "\#ifndef ASM_GENERIC_$${upper}\n" > $@; \
>>> + printf "\#define ASM_GENERIC_$${upper}\n" >> $@; \
>>> + printf "\#include <asm-generic/$*.h>\n" >> $@; \
>>> + printf "\#endif /* ASM_GENERIC_$${upper} */\n" >> $@
>>
>> I'm curious: In what is now a0f56da94c3e I had to resort to "define" to
>> get the rule to work (including a correct .*.cmd being generated). I
>> can't claim I actually understood why things didn't work the "simple
>> macro" way, and hence it's unclear to me whether the way it's done here
>> will work with all make versions.
>
> This works:
>
> cmd_xlat_h = \
> printf "\#ifndef COMPAT_XLAT_H\n" >$@.new; \
> printf "\#define COMPAT_XLAT_H\n" >>$@.new; \
> cat $(filter %.h,$^) >>$@.new; \
> printf "" >>$@.new; \
> printf "\#endif /* COMPAT_XLAT_H */\n" >>$@.new; \
> mv -f $@.new $@
>
> I made these changes:
> - tab instead of spaces
> - printf instead of echo
> - escape # and add \n
Hmm, out of these I guess it were the un-escaped #-es then. In your rule
I think the simpler "echo" would also be preferable.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |