star-ty

Generate content for online publication
git clone git://git.meso-star.fr/star-ty.git
Log | Files | Refs | README | LICENSE

commit eea327242068759cae78c38d6097a36b23cd4beb
parent e0148804681f4f95746ced80da58d7ae9a83ee8d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  3 Oct 2025 19:40:12 +0200

Add a "clean" Makefile target for hooks

This forces them to be re-executed without deleting the files they
generated, allowing the hooks to determine whether to generate them. The
goal is to speed up their execution time, as some processes can take a
long time.

Diffstat:
Msrc/sty-hooks | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/sty-hooks b/src/sty-hooks @@ -121,11 +121,24 @@ printf '%s\n' "${hook}" | while read -r i; do # Run it on "distclean" and not on "clean", as their generation can be # costly while effectively being files generated to "distribute" the # website. - printf '%s-clean:\n' "${prefix}" + printf '%s-distclean:\n' "${prefix}" printf ' if [ -f %s ]; then cat %s | xargs rm -f; fi\n' \ "${tgt}" "${tgt}" printf ' rm -f %s\n' "${tgt}" - printf 'distclean__: %s-clean\n' "${prefix}" + printf 'distclean__: %s-distclean\n' "${prefix}" + + # Set the target to "lightly" clean up the hook, i.e., force it to + # re-execute without deleting the files it would generate. This way, + # the hooks could query these files in order to regenerate them + # depending on whether they deem it necessary or not. + # + # This aims to speed up the re-execution of hooks, as there is no way + # to track their dependencies, meaning that their (conditional) + # re-execution is often the only way to ensure that content is up to + # date with the latest updates. + printf '%s-clean:\n' "${prefix}" + printf ' rm -f %s\n' "${tgt}" + printf 'clean__: %s-clean\n' "${prefix}" # Set the target that installs website resources generated by the hook printf '%s-install: %s\n' "${prefix}" "${tgt}"