git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 4/4] makefile/meson: add 'check-headers' as alias for 'hdr-check'

From
Karthik Nayak <karthik.188@gmail.com>
Date
Apr 20, 2025, 11:02 UTC
Message-ID
<CAOLa=ZRPjeGP-yF_p-vve22mW8SrtqV_i_4JrjmGt1hRSqrGPg@mail.gmail.com>
In-Reply-To
<f7d086eb-e616-4bf6-a679-6894ad6eaa85@gmail.com>
phillip.wood123@gmail.com writes:
Show 63 quoted lines
> Hi Karthik
>
> On 14/04/2025 22:16, Karthik Nayak wrote:
>> The 'hdr-check' target in Meson and makefile is used to check if headers
>> can be compiled individually. The naming however isn't readable as 'hdr'
>> is not a common shortforme for 'header', neither is it an abbreviation.
>>
>> Let's introduce 'check-headers' as an alternative target for 'hdr-check'
>> and add a `TODO` to deprecate the latter after 2 releases. Since this
>> is an internal tool, we can use a shorter deprecation cycle.
>
> Thanks for renaming this. I've left one small question at below but this
> basically looks good to me.
>
>> diff --git a/Makefile b/Makefile
>> index ac32d2d0bd..961ee508be 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -3326,8 +3326,10 @@ HCC = $(HCO:hco=hcc)
>>   $(HCO): %.hco: %.hcc $(GENERATED_H) FORCE
>>   	$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
>>
>> -.PHONY: hdr-check $(HCO)
>> +# TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+
>> +.PHONY: hdr-check check-headers $(HCO)
>>   hdr-check: $(HCO)
>> +check-headers: hdr-check
>>
>>   .PHONY: style
>>   style:
>> diff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh
>> index 0d51e5ce0e..60c175a094 100755
>> --- a/ci/run-static-analysis.sh
>> +++ b/ci/run-static-analysis.sh
>> @@ -26,7 +26,7 @@ then
>>   	exit 1
>>   fi
>>
>> -make hdr-check ||
>> +make check-headers ||
>>   exit 1
>>
>>   make check-pot
>> diff --git a/meson.build b/meson.build
>> index b1be2b3cbb..745cb30165 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -2062,7 +2062,9 @@ if git.found() and compiler.get_argument_syntax() == 'gcc'
>>       hco_targets += hco
>>     endforeach
>>
>> +  # TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+
>>     alias_target('hdr-check', hco_targets)
>> +  alias_target('check-headers', hco_targets)
>
> This looks good. One minor question which isn't worth a re-roll on its
> own - in the Makefile the check-headers target depends on the hdr-check
> target which means the two will always use the same dependencies. Here
> we make check-headers depend on hco_targets instead which means that in
> theory the two targets could get out of sync if the dependencies of
> hdr-check changed. Is it possible to have a meson target that depends on
> hdr-check directly?
>

That's a good question, I didn't think much about it then, but looking into it, seems like we can do

  diff --git a/meson.build b/meson.build
  index 3bf3d65e8b..39319e2610 100644
  --- a/meson.build
  +++ b/meson.build
  @@ -2055,8 +2055,8 @@ if git.found() and
compiler.get_argument_syntax() == 'gcc'
     endforeach
     # TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+
  -  alias_target('hdr-check', hco_targets)
  -  alias_target('check-headers', hco_targets)
  +  hdr_check = alias_target('hdr-check', hco_targets)
  +  alias_target('check-headers', hdr_check)
   endif
   foreach key, value : {

Not sure if there is a more idiomatic way, but this works. Will add in the next version.

Show 8 quoted lines
> Best Wishes
>
> Phillip
>
>>   endif
>>
>>   foreach key, value : {
>>
Previous: phillip.wood123@gmail.com
Message 13 of 13 in “meson: add corresponding target for Makefile's hdr-check”
  1. 0/4 meson: add corresponding target for Makefile's hdr-checkKarthik Nayak, Apr 14, 2025
  2. 1/4 coccinelle: meson: rename variables to be more specificKarthik Nayak, Apr 14, 2025
  3. 2/4 meson: move headers definition from 'contrib/coccinelle'Karthik Nayak, Apr 14, 2025
  4. Phillip WoodApr 15, 2025
  5. Karthik NayakApr 20, 2025
  6. 3/4 meson: add support for 'hdr-check'Karthik Nayak, Apr 14, 2025
  7. Junio C HamanoApr 14, 2025
  8. Karthik NayakApr 15, 2025
  9. phillip.wood123@gmail.comApr 15, 2025
  10. Karthik NayakApr 20, 2025
  11. 4/4 makefile/meson: add 'check-headers' as alias for 'hdr-check'Karthik Nayak, Apr 14, 2025
  12. phillip.wood123@gmail.comApr 15, 2025
  13. Karthik NayakApr 20, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.