Skip to content

Commit d8ebfac

Browse files
committed
Merge branch 'dk/meson-regen-config-list' into jch
Fix dependency screw-up in meson-based builds * dk/meson-regen-config-list: build: regenerate config-list.h when Documentation changes
2 parents a3e1bbf + 819447d commit d8ebfac

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,9 +2691,10 @@ $(BUILT_INS): git$X
26912691
cp $< $@
26922692

26932693
config-list.h: generate-configlist.sh
2694+
@mkdir -p .depend
2695+
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ .depend/config-list.h.d
26942696

2695-
config-list.h: Documentation/*config.adoc Documentation/config/*.adoc
2696-
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
2697+
-include .depend/config-list.h.d
26972698

26982699
command-list.h: generate-cmdlist.sh command-list.txt
26992700

generate-configlist.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
SOURCE_DIR="$1"
44
OUTPUT="$2"
5+
DEPFILE="$3"
56

67
if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
78
then
8-
echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
9+
echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT> [<DEPFILE>]"
910
exit 1
1011
fi
1112

@@ -36,3 +37,11 @@ EOF
3637
echo
3738
print_config_list
3839
} >"$OUTPUT"
40+
41+
if test -n "$DEPFILE"
42+
then
43+
QUOTED_OUTPUT="$(printf '%s\n' "$OUTPUT" | sed 's,[&/\],\\&,g')"
44+
printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \
45+
"$SOURCE_DIR"/Documentation/config/*.adoc |
46+
sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /" >"$DEPFILE"
47+
fi

meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,14 @@ endif
722722

723723
builtin_sources += custom_target(
724724
output: 'config-list.h',
725+
depfile: 'config-list.h.d',
726+
depend_files: [ 'generate-configlist.sh' ],
725727
command: [
726728
shell,
727-
meson.current_source_dir() + '/generate-configlist.sh',
729+
meson.current_source_dir() / 'generate-configlist.sh',
728730
meson.current_source_dir(),
729731
'@OUTPUT@',
732+
'@DEPFILE@',
730733
],
731734
env: script_environment,
732735
)

0 commit comments

Comments
 (0)