diff --git a/Makefile b/Makefile index 7459b12a1..b0ec4870c 100644 --- a/Makefile +++ b/Makefile @@ -301,7 +301,8 @@ indent.c: # simple want to examine, run / test winning IOCCC entries. .PHONY: help genpath genfilelist verify_entry_files gen_authors gen_location gen_years \ - find_missing_links test entry_index gen_top_html thanks gen_other_html quick_entry_index \ + find_missing_links test entry_index gen_top_html thanks gen_other_html \ + quick_other_html quick_entry_index \ gen_year_index quick_www www untar_entry_tarball untar_year_tarball \ form_entry_tarball form_year_tarball tar gen_status gen_sitemap \ sitemap timestamp update csv2entry entry2csv @@ -339,6 +340,7 @@ help: @echo 'make gen_years ;: generate the top level years.html page' @echo 'make entry_index ;: force the build of ALL winner index.html files' @echo 'make gen_other_html ;: build entry HTML files from markdown other than README.md' + @echo 'make quick_other_html ;: build entry non-index.html files that might be out of date' @echo 'make gen_year_index ;: generate year level index.html files using from README.md files' @echo 'make gen_top_html ;: generate a number of the top level HTML files from markdown' @echo 'make gen_next ;: generate the HTML files in next/' @@ -511,6 +513,17 @@ gen_other_html: ${GEN_OTHER_HTML} ${GEN_OTHER_HTML} -v 1 @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' +# build entry HTML files from non-README.md markdown files that might be out of date +# +# This rule uses the -Q option of ${GEN_OTHER_HTML}, so that some +# non-README.md markdown files that seem to be up to date (but might +# not be up to date) won't be built. +# +quick_other_html: ${GEN_OTHER_HTML} + @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' + ${GEN_OTHER_HTML} -v 1 -Q + @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' + # generate year level index.html files using the # ${GEN_YEAR_INDEX} tool (bin/gen-year-index.sh). # @@ -661,7 +674,7 @@ quick_www: ${MAKE} gen_year_index ${MAKE} gen_top_html ${MAKE} quick_entry_index - ${MAKE} gen_other_html + ${MAKE} quick_other_html ${MAKE} find_missing_links @echo '=-=-=-=-=-= IOCCC complete make $@ =-=-=-=-=-=' diff --git a/bin/gen-other-html.sh b/bin/gen-other-html.sh index 0eaa727e4..719cbb736 100755 --- a/bin/gen-other-html.sh +++ b/bin/gen-other-html.sh @@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.2.6 2024-08-05" +export VERSION="1.3 2024-08-11" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -111,6 +111,7 @@ export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc" # export NOOP= export DO_NOT_PROCESS= +export QUICK_MODE= export EXIT_CODE="0" # clear options we will add to tools @@ -121,7 +122,7 @@ declare -ag TOOL_OPTION # usage # export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N] - [-t tagline] [-T md2html.sh] [-p tool] [-w site_url] + [-t tagline] [-T md2html.sh] [-Q] [-p tool] [-w site_url] -h print help message and exit -v level set verbosity level (def level: 0) @@ -139,6 +140,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N] NOTE: The '-t tagline' is passed as leading options on tool command lines. -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH) NOTE: The '-T md2html.sh' is passed as leading options on tool command lines. + -Q quick mode, do not run $MD2HTML_SH unless markdown is out of date (def: do) -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER) @@ -165,7 +167,7 @@ $NAME version: $VERSION" # parse command line # -while getopts :hv:Vd:D:nNt:T:p:w: flag; do +while getopts :hv:Vd:D:nNt:T:Qp:w: flag; do case "$flag" in h) echo "$USAGE" 1>&2 exit 2 @@ -216,6 +218,8 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do TOOL_OPTION+=("-T") TOOL_OPTION+=("$MD2HTML_SH") ;; + Q) QUICK_MODE="-Q" + ;; p) PANDOC_WRAPPER="$OPTARG" TOOL_OPTION+=("-p") TOOL_OPTION+=("$PANDOC_WRAPPER") @@ -358,6 +362,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 + echo "$0: debug[3]: QUICK_MODE=$QUICK_MODE" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 @@ -579,6 +584,24 @@ for YYYY in $(< "$TOP_FILE"); do HTML_BASENAME=$(basename "$HTML_FILE") export HTML_BASENAME + # determine if we need to run the tool + # + # Check if the non-empty foo.html is newer than foo.md. + # + if [[ -n $QUICK_MODE ]]; then + if [[ $V_FLAG -ge 5 ]]; then + echo "$0: debug[5]: listing of important files, if they exist, starts below" 1>&2 + ls -lRt -- "$HTML_FILE" "$MD_FILE" 2>/dev/null + echo "$0: debug[5]: listing of important files, if they exist, ends above" 1>&2 + fi + if [[ -s $HTML_FILE && $HTML_FILE -nt $MD_FILE ]]; then + if [[ $V_FLAG -ge 3 ]]; then + echo "$0: debug[3]: does not need to be updated: $HTML_FILE" 1>&2 + fi + continue + fi + fi + # determine the description arg # export DESCRIPTION="DESCRIPTION=$MD_BASENAME for $YYYY_DIR" diff --git a/bin/quick-readme2index.sh b/bin/quick-readme2index.sh index 637da192c..99b8a07b2 100755 --- a/bin/quick-readme2index.sh +++ b/bin/quick-readme2index.sh @@ -521,7 +521,7 @@ fi # determine if we need to run the tool # -# Check if the non-empty index.html is newer than the .entry.json file. +# Check if the non-empty index.html is newer than both README.md and .entry.json files. # if [[ $V_FLAG -ge 5 ]]; then echo "$0: debug[5]: listing of important files, if they exist, starts below" 1>&2