commit 9105cbfa71b9ead90645a54ba69ffc8ebe308a06
parent 0a2327a993824a4d3c2bec034352163f83683595
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 26 Aug 2025 18:23:10 +0200
Update execution target of a hook
The target file is deleted if an error occurs during hook execution,
forcing it to be re-executed during the next make.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/hooks.sh b/scripts/hooks.sh
@@ -84,8 +84,9 @@ printf '%s\n' "${hook}" | while read -r i; do
# Finally, make this target a prerequisite for building the website
# in order to enforce its execution during the build call.
printf '%s: %s %s\n' "${tgt}" "${i}" "${dep}"
- printf " @( cd -- %s && \$(SHELL) %s ) > \$@\n" \
- "${section}" "${hook}"
+ printf ' @cd -- %s; ' "${section}"
+ printf "\$(SHELL) %s > \$\${OLDPWD}/\$@ || rm -f \$\${OLDPWD}/\$@\n" \
+ "${hook}"
# Set the target for cleaning files generated by executing the hook.
# Run it on "distclean" and not on "clean", as their generation can be