Merge pull request #2320 from xexyl/sicherman85-make-alt

Don't build alt automatically in 1985/sicherman
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-05-05 21:41:27 -07:00
commit 2037618d92
5 files changed
+187 -90

No files matched your search

+4 -2
View File
@@ -136,14 +136,16 @@ all: data ${TARGET}
sandwich supernova deep_magic magic charon pluto sandwich supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}.alt.c ${PROG}: ${PROG}.c ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} || \ ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
${CC} ${CFLAGS} ${PROG}.alt.c -o $@ ${LDFLAGS}
# alternative executable # alternative executable
# #
alt: data ${ALT_TARGET} alt: data ${ALT_TARGET}
@${TRUE} @${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} ${PROG}.alt.c -o $@ ${LDFLAGS}
# data files # data files
# #
data: ${DATA} data: ${DATA}
+2 -7
View File
@@ -4,9 +4,8 @@
make all make all
``` ```
There is another version that will be compiled in case the first fails. This There is another version that can be compiled in case the first fails.
should happen automatically. See [Alternate code](#alternate-code) below for See [Alternate code](#alternate-code) below for more details on it.
more details on it.
## To use: ## To use:
@@ -40,15 +39,11 @@ audience.
### Alternate build: ### Alternate build:
Although this will be built if the original fails to compile you can do it
manually like:
``` <!---sh--> ``` <!---sh-->
make alt make alt
``` ```
In this case it will be built as `sicherman.alt`.
### Alternate use: ### Alternate use:
+2 -6
View File
@@ -397,9 +397,8 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- BEFORE: 1st line of markdown file: 1985/sicherman/README.md --> <!-- BEFORE: 1st line of markdown file: 1985/sicherman/README.md -->
<h2 id="to-build">To build:</h2> <h2 id="to-build">To build:</h2>
<pre><code> make all</code></pre> <pre><code> make all</code></pre>
<p>There is another version that will be compiled in case the first fails. This <p>There is another version that can be compiled in case the first fails.
should happen automatically. See <a href="#alternate-code">Alternate code</a> below for See <a href="#alternate-code">Alternate code</a> below for more details on it.</p>
more details on it.</p>
<h2 id="to-use">To use:</h2> <h2 id="to-use">To use:</h2>
<pre><code> ./sicherman &lt; file <pre><code> ./sicherman &lt; file
@@ -417,10 +416,7 @@ will be built in the case of the <a href="https://github.com/ioccc-src/temp-test
In this case it’ll be compiled to <code>sicherman</code> to simplify it for the larger In this case it’ll be compiled to <code>sicherman</code> to simplify it for the larger
audience.</p> audience.</p>
<h3 id="alternate-build">Alternate build:</h3> <h3 id="alternate-build">Alternate build:</h3>
<p>Although this will be built if the original fails to compile you can do it
manually like:</p>
<pre><code> make alt</code></pre> <pre><code> make alt</code></pre>
<p>In this case it will be built as <code>sicherman.alt</code>.</p>
<h3 id="alternate-use">Alternate use:</h3> <h3 id="alternate-use">Alternate use:</h3>
<pre><code> ./sicherman.alt &lt; file</code></pre> <pre><code> ./sicherman.alt &lt; file</code></pre>
<h3 id="alternate-try">Alternate try:</h3> <h3 id="alternate-try">Alternate try:</h3>
+1 -1
View File
@@ -406,7 +406,7 @@ gen_top_html: ${GEN_TOP_HTML}
# Just kidding .. So Long, and Thanks for All the Fish :-) # Just kidding .. So Long, and Thanks for All the Fish :-)
thanks: ${GEN_TOP_HTML} thanks-for-help.md thanks: ${GEN_TOP_HTML} thanks-for-help.md
@echo "Thanks for all the help ..." @echo "Thanks for all the help ..."
@${GEN_TOP_HTML} @${GEN_TOP_HTML} thanks-for-help
@echo "... and thanks for all the fish :-)" @echo "... and thanks for all the fish :-)"
# build entry HTML files from markdown other than README.md to index.html # build entry HTML files from markdown other than README.md to index.html
+178 -74
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# gen-top-html.sh - generate select top level HTML files from markdown files # gen-top-html.sh - generate all or select top level HTML files from markdown files
# #
# We also generate the bin/index.html file from the bin/README.md file. # We also generate the bin/index.html file from the bin/README.md file.
# We also generate the inc/index.html file from the inc/README.md file. # We also generate the inc/index.html file from the inc/README.md file.
@@ -8,6 +8,12 @@
# #
# Copyright (c) 2024 by Landon Curt Noll. All Rights Reserved. # Copyright (c) 2024 by Landon Curt Noll. All Rights Reserved.
# #
# Cody Boone Ferguson made an improvement where one can specify the select top
# html files to generate to save time. Works just like the script without args
# but if any args are specified and the markdown file exists it will just
# generate that or those html files. This is to save time for some Makefile
# rules that only need update one file.
#
# Permission to use, copy, modify, and distribute this software and # Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted, # its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright, this permission notice and text # provided that the above copyright, this permission notice and text
@@ -87,7 +93,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message # set variables referenced in the usage message
# #
export VERSION="1.4.5 2024-04-23" export VERSION="1.4.6 2024-05-05"
NAME=$(basename "$0") NAME=$(basename "$0")
export NAME export NAME
export V_FLAG=0 export V_FLAG=0
@@ -130,6 +136,7 @@ TOP_MD_SET+=("next/guidelines")
TOP_MD_SET+=("next/rules") TOP_MD_SET+=("next/rules")
TOP_MD_SET+=("nojs-menu") TOP_MD_SET+=("nojs-menu")
TOP_MD_SET+=("thanks-for-help") TOP_MD_SET+=("thanks-for-help")
declare -ag TOP_MD_SELECT_SET
# #
export NOOP= export NOOP=
export DO_NOT_PROCESS= export DO_NOT_PROCESS=
@@ -143,7 +150,7 @@ declare -ag TOOL_OPTION
# usage # usage
# #
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N] export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
[-t tagline] [-T md2html.sh] [-p tool] [-u repo_url] [-t tagline] [-T md2html.sh] [-p tool] [-u repo_url] [file...]
-h print help message and exit -h print help message and exit
-v level set verbosity level (def level: 0) -v level set verbosity level (def level: 0)
@@ -283,7 +290,22 @@ shift $(( OPTIND - 1 ));
if [[ $V_FLAG -ge 5 ]]; then if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: file argument count: $#" 1>&2 echo "$0: debug[5]: file argument count: $#" 1>&2
fi fi
#
# allow specifying specific files to generate
FILE_COUNT="$#"
while [[ $# -ne 0 ]]; do
for (( index=0; index < ${#TOP_MD_SET[@]}; index++ )); do
if [[ "${TOP_MD_SET[$index]}" = "$1" ]]; then
TOP_MD_SELECT_SET+=("$1")
fi
done
shift 1
done
if [[ "$FILE_COUNT" != 0 && ${#TOP_MD_SELECT_SET[@]} = 0 ]]; then
echo "$0: ERROR: no select files specified are in allowed set" 1>&2
exit 3
fi
if [[ $# -ne 0 ]]; then if [[ $# -ne 0 ]]; then
echo "$0: ERROR: expected 0 args, found: $#" 1>&2 echo "$0: ERROR: expected 0 args, found: $#" 1>&2
exit 3 exit 3
@@ -414,6 +436,11 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2 echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
if (( ${#TOP_MD_SELECT_SET[@]} )); then
for index in "${!TOP_MD_SELECT_SET[@]}"; do
echo "$0: debug[3]: TOP_MD_SELECT_SET[$index]=${TOP_MD_SELECT_SET[$index]}" 1>&2
done
fi
for index in "${!TOP_MD_SET[@]}"; do for index in "${!TOP_MD_SET[@]}"; do
echo "$0: debug[3]: TOP_MD_SET[$index]=${TOP_MD_SET[$index]}" 1>&2 echo "$0: debug[3]: TOP_MD_SET[$index]=${TOP_MD_SET[$index]}" 1>&2
done done
@@ -442,80 +469,157 @@ fi
# process the entire markdown set # process the entire markdown set
# #
for name in "${TOP_MD_SET[@]}"; do if (( ${#TOP_MD_SELECT_SET[@]} )); then
for name in "${TOP_MD_SELECT_SET[@]}"; do
# verify that the markdown file exists at the topdir # verify that the markdown file exists at the topdir
# #
export MD_FILE="$name.md" export MD_FILE="$name.md"
if [[ ! -e $MD_FILE ]]; then if [[ ! -e $MD_FILE ]]; then
echo "$0: Warning: markdown file does not exist: $MD_FILE" 1>&2 echo "$0: Warning: markdown file does not exist: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8 EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -f $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a regular file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -r $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a readable file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -s $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a non-empty readable file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
export HTML_FILE="$name.html"
# bin/README is a special case
if [[ $name == bin/README ]]; then
HTML_FILE="bin/index.html"
fi
# inc/README is a special case
if [[ $name == inc/README ]]; then
HTML_FILE="inc/index.html"
fi
# next/README is a special case
if [[ $name == next/README ]]; then
HTML_FILE="next/index.html"
fi
# archive/historic/README is a special case
if [[ $name == archive/historic/README ]]; then
HTML_FILE="archive/historic/index.html"
fi
# use the md2html.sh tool to form the HTML file, unless -n
#
if [[ -z $NOOP ]]; then
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: about to run: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" 1>&2
fi
"$MD2HTML_SH" -U "$SITE_URL/$HTML_FILE" "${TOOL_OPTION[@]}" \
-m "$MD_FILE" -- "$MD_FILE" "$HTML_FILE"
status="$?"
if [[ $status -ne 0 ]]; then
echo "$0: Warning: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" \
"failed, error: $status" 1>&2
EXIT_CODE="1" # exit 1
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
elif [[ $V_FLAG -ge 3 ]]; then continue
echo "$0: debug[3]: now up to date: $HTML_FILE" 1>&2 fi
if [[ ! -f $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a regular file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -r $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a readable file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -s $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a non-empty readable file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
export HTML_FILE="$name.html"
# bin/README is a special case
if [[ $name == bin/README ]]; then
HTML_FILE="bin/index.html"
fi
# inc/README is a special case
if [[ $name == inc/README ]]; then
HTML_FILE="inc/index.html"
fi
# next/README is a special case
if [[ $name == next/README ]]; then
HTML_FILE="next/index.html"
fi
# archive/historic/README is a special case
if [[ $name == archive/historic/README ]]; then
HTML_FILE="archive/historic/index.html"
fi fi
# report disabled by -n # use the md2html.sh tool to form the HTML file, unless -n
# #
elif [[ $V_FLAG -ge 5 ]]; then if [[ -z $NOOP ]]; then
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \ if [[ $V_FLAG -ge 1 ]]; then
"-m $MD_FILE -- $MD_FILE $HTML_FILE" 1>&2 echo "$0: debug[1]: about to run: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
fi "-m $MD_FILE -- $MD_FILE $HTML_FILE" 1>&2
done fi
"$MD2HTML_SH" -U "$SITE_URL/$HTML_FILE" "${TOOL_OPTION[@]}" \
-m "$MD_FILE" -- "$MD_FILE" "$HTML_FILE"
status="$?"
if [[ $status -ne 0 ]]; then
echo "$0: Warning: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" \
"failed, error: $status" 1>&2
EXIT_CODE="1" # exit 1
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now up to date: $HTML_FILE" 1>&2
fi
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" 1>&2
fi
done
else
for name in "${TOP_MD_SET[@]}"; do
# verify that the markdown file exists at the topdir
#
export MD_FILE="$name.md"
if [[ ! -e $MD_FILE ]]; then
echo "$0: Warning: markdown file does not exist: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -f $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a regular file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -r $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a readable file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ ! -s $MD_FILE ]]; then
echo "$0: Warning: markdown file is not a non-empty readable file: $MD_FILE" 1>&2
EXIT_CODE=8 # exit 8
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
export HTML_FILE="$name.html"
# bin/README is a special case
if [[ $name == bin/README ]]; then
HTML_FILE="bin/index.html"
fi
# inc/README is a special case
if [[ $name == inc/README ]]; then
HTML_FILE="inc/index.html"
fi
# next/README is a special case
if [[ $name == next/README ]]; then
HTML_FILE="next/index.html"
fi
# archive/historic/README is a special case
if [[ $name == archive/historic/README ]]; then
HTML_FILE="archive/historic/index.html"
fi
# use the md2html.sh tool to form the HTML file, unless -n
#
if [[ -z $NOOP ]]; then
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: about to run: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" 1>&2
fi
"$MD2HTML_SH" -U "$SITE_URL/$HTML_FILE" "${TOOL_OPTION[@]}" \
-m "$MD_FILE" -- "$MD_FILE" "$HTML_FILE"
status="$?"
if [[ $status -ne 0 ]]; then
echo "$0: Warning: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" \
"failed, error: $status" 1>&2
EXIT_CODE="1" # exit 1
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now up to date: $HTML_FILE" 1>&2
fi
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \
"-m $MD_FILE -- $MD_FILE $HTML_FILE" 1>&2
fi
done
fi
# All Done!!! -- Jessica Noll, Age 2 # All Done!!! -- Jessica Noll, Age 2
# #