From: Toon Claes Date: Mon, 14 Apr 2025 08:45:49 GMT Subject: Re: [PATCH v2 3/4] meson: add support for 'hdr-check' Message-ID: <87mscj5dxe.fsf@iotcl.com> In-Reply-To: <20250410-505-wire-up-sparse-via-meson-v2-3-acb45cc8a2e5@gmail.com> Karthik Nayak writes: > The Makefile supports a target called 'hdr-check', which checks if > individual header files can be independently compiled. Let's port this > functionality to meson, our new build system too. The implementation > resembles that of the Makefile and provides the same check. > > Signed-off-by: Karthik Nayak > --- > meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 107 insertions(+) > > diff --git a/meson.build b/meson.build > index 790d178007..6fce1aa618 100644 > --- a/meson.build > +++ b/meson.build > @@ -655,6 +655,12 @@ if git.found() > endforeach > endif > > +headers_generated = [ > + 'command-list.h', > + 'config-list.h', > + 'hook-list.h' > +] Can we maybe compose this list by instead doing: generated_headers = [] foreach f : builtin_sources + libgit_sources + third_party_sources if f.endswith(".h") generated_headers += f endif endforeach (This would take `third_party_sources` into account as suggested by Patrick[1]). If we consider that too much magic, I would suggest: generated_headers = [] builtin_sources += custom_target( output: 'config-list.h', command: [ shell, meson.current_source_dir() + '/generate-configlist.sh', meson.current_source_dir(), '@OUTPUT@', ], env: script_environment, ) generated_headers += 'config-list.h' I hope this would reduce the chance to forget to add more headers to this list (assuming people copy the code blurb from another location). -- Toon