meso-web

Sources of the |Méso|Star> website
git clone git://git.meso-star.fr/meso-web.git
Log | Files | Refs | README | LICENSE

commit 12a3f977fbe6679cbcd8704032ec82b657472fc6
parent c7fb84fe8c58f5c9b747479f6de230a9fd704535
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 25 Aug 2025 14:27:21 +0200

Upd the dependency between the hook and the HTML

Only scripts used to generate HTML content can depend on the hook being
executed, not the HTML files. This not only improves (slightly) the
efficiency of compilation, but also ensures the accuracy of parallel
generation: scripts that generate HTML must not be executed before
hooks.

Do not make the execution of all hooks a prerequisite for building: let
the HTML section rules ensure the correct order of execution between
hooks and the generation of web pages.

Diffstat:
Mhooks.sh | 7+++----
Mlist.sh | 13+++++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/hooks.sh b/hooks.sh @@ -23,11 +23,11 @@ set -e # Print on standard output the Makefile targets used to automate hook # management -html="$(sh ./list.sh html)" +shtml="$(sh ./list.sh shtml)" hook="$(sh ./list.sh hook)" sections | while read -r i; do - html_section="$(printf '%s\n' "${html}" \ + shtml_section="$(printf '%s\n' "${shtml}" \ | sed -n "/^${i}\//p" | tr '\n' ' ')" hook_section="$(printf '%s\n' "${hook}" \ | sed -n "/^${i}\//p" | tr '\n' ' ' \ @@ -41,7 +41,7 @@ sections | while read -r i; do # themselves, because even if the scripts have not changed, their # output may have been updated, which can impact the HTML content # generated at build time. - printf '%s: %s\n' "${html_section}" "${hook_section}" + printf '%s: %s\n' "${shtml_section}" "${hook_section}" done printf '%s\n' "${hook}" | while read -r i; do @@ -86,7 +86,6 @@ printf '%s\n' "${hook}" | while read -r i; do printf '%s: %s %s\n' "${tgt}" "${i}" "${dep}" printf " @( cd -- %s && \$(SHELL) %s ) > \$@\n" \ "${section}" "${hook}" - printf 'build__: %s\n' "${tgt}" # Set the target for cleaning files generated by executing the hook. # Run it on "distclean" and not on "clean", as their generation can be diff --git a/list.sh b/list.sh @@ -44,6 +44,19 @@ html() | sort" } +# List of shell scripts that dynamically generate HTML content +shtml() +{ + _find_args="$(\ + printf '%s\n' "${sections}" \ + | sed -e 's/^/! -path /' \ + | tr '\n' ' ')" + + eval "exec find ${search_dirs} ${_find_args} -type d -prune -o \ + -name \"*.sh\" -print \ + | sort" +} + # List of hooks, i.e. shell scripts to be run by section hook() {