Re: [PATCH v6] build: regenerate config-list.h when Documentation changes
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Feb 24, 2026, 11:00 UTC
- Message-ID
- <39acbf7e-86f4-4dbe-8b58-3c04fccd7984@gmail.com>
- In-Reply-To
- <aZ12Lk85bSajirCY@pks.im>
On 24/02/2026 09:58, Patrick Steinhardt wrote:
Show 77 quoted lines
> On Mon, Feb 23, 2026 at 04:41:48PM -0500, Ben Knoble wrote:
>>> Le 23 févr. 2026 à 01:55, SZEDER Gábor <szeder.dev@gmail.com> a écrit :
>>> On Sat, Feb 21, 2026 at 09:07:17AM -0500, D. Ben Knoble wrote:
>>>> diff --git a/Makefile b/Makefile
>>>> index 7f37ad8f58..6f926ffb1f 100644
>>>> --- a/Makefile
>>>> +++ b/Makefile
>>>> @@ -2688,9 +2688,10 @@ $(BUILT_INS): git$X
>>>> cp $< $@
>>>>
>>>> config-list.h: generate-configlist.sh
>>>> + @mkdir -p .depend
>>>> + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ .depend/config-list.h.d
>>>>
>>>> -config-list.h: Documentation/*config.adoc Documentation/config/*.adoc
>>>> - $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
>>>> +-include .depend/config-list.h.d
>>>
>>> This breaks the build when something disappears from
>>> Documentation/config/:
>>>
>>> $ git checkout origin/seen
>>> HEAD is now at 57edfa3ce8 Merge branch 'ty/setup-error-tightening' into seen
>>> $ ls -l Documentation/config/hook.adoc
>>> -rw-rw-r-- 1 szeder szeder 3828 Feb 23 07:50 Documentation/config/hook.adoc
>>> $ git grep hook.adoc
>>> Documentation/git-hook.adoc:include::config/hook.adoc[]
>>> Documentation/howto/meson.build: 'rebuild-from-update-hook.adoc',
>>> Documentation/meson.build: 'git-hook.adoc' : 1,
>>> $ make V=1 config-list.h
>>> /bin/sh ./generate-configlist.sh . config-list.h .depend/config-list.h.d
>>> $ git checkout 0aabf70f60
>>> Previous HEAD position was 57edfa3ce8 Merge branch 'ty/setup-error-tightening' into seen
>>> HEAD is now at 0aabf70f60 build: regenerate config-list.h when Documentation changes
>>> $ ls -l Documentation/config/hook.adoc
>>> ls: cannot access 'Documentation/config/hook.adoc': No such file or directory
>>> $ git grep hook.adoc
>>> Documentation/howto/meson.build: 'rebuild-from-update-hook.adoc',
>>> Documentation/meson.build: 'git-hook.adoc' : 1,
>>> $ make V=1 config-list.h
>>> GIT_VERSION=2.53.0.119.g0aabf70f60
>>> make: *** No rule to make target 'Documentation/config/hook.adoc', needed by 'config-list.h'. Stop.
>>> $ grep hook.adoc .depend/config-list.h.d
>>> config-list.h: ./Documentation/config/hook.adoc
>>
>> Indeed. This might arise while bisecting, which was my original
>> motivation. Thoughts on a path forward? At least this issue (to me) is
>> clearer than a spurious test failure :)
>
> For Meson this case works alright. So maybe we just drop the changes to
> the Makefile and call it a day?
>
> An alternative would be to have the following patch on top:
>
> diff --git a/generate-configlist.sh b/generate-configlist.sh
> index 39ac8845ab..e28054f9e0 100755
> --- a/generate-configlist.sh
> +++ b/generate-configlist.sh
> @@ -41,7 +41,12 @@ EOF
> if test -n "$DEPFILE"
> then
> QUOTED_OUTPUT="$(printf '%s\n' "$OUTPUT" | sed 's,[&/\],\\&,g')"
> - printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \
> - "$SOURCE_DIR"/Documentation/config/*.adoc |
> - sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /" >"$DEPFILE"
> + {
> + printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \
> + "$SOURCE_DIR"/Documentation/config/*.adoc |
> + sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /"
> + printf '%s:\n' "$SOURCE_DIR"/Documentation/*config.adoc \
> + "$SOURCE_DIR"/Documentation/config/*.adoc |
> + sed -e 's/[# ]/\\&/g'
> + } >"$DEPFILE"
> fi
>
> What it does is to also create an empty target for all of the
> dependencies. Which is in fact what GCC/Clang also do when you pass -MP:Oh, I was wondering how they got around the problem we're seeing here. While it seems ninja is happy it ignore missing dependencies in depfiles, are we sure the build systems meson uses on other platforms are as well? If not it might be worth adding this, rather than just dropping the Makefile changes.
Thanks
Phillip
Show 15 quoted lines
>
> $ cat main.c
> #include "foo.h"
> int main()
> {
> puts("foobar");
> return 0;
> }
>
> $ clang -MMD -MP main.c
> $ cat main.d
> main.o: main.c foo.h
> foo.h:
>
> Patrick