aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/makemake
diff options
context:
space:
mode:
Diffstat (limited to 'v2/src/bin/makemake')
-rwxr-xr-xv2/src/bin/makemake253
1 files changed, 0 insertions, 253 deletions
diff --git a/v2/src/bin/makemake b/v2/src/bin/makemake
deleted file mode 100755
index 3956844..0000000
--- a/v2/src/bin/makemake
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/bin/sh
-set -eu
-
-
-usage() {
- cat <<-'EOF'
- Usage:
- makemake
- makemake -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
- Options:
- -h, --help show this message
-
-
- Generate make(1) code for later evaluation by make(1). What
- this scripts does is fill the gap where make(1) can't handle
- globs and dynamic dependencies, and uses some ad-hoc scripts
- to generate those.
- EOF
-}
-
-for flag in "$@"; do
- case "$flag" in
- --)
- break
- ;;
- --help)
- usage
- help
- exit
- ;;
- *)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- h)
- usage
- help
- exit
- ;;
- *)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-
-
-varlist() {
- printf '%s = \\\n' "$1"
- sed \
- -e 's/^/ /' \
- -e 's/$/ \\/'
- printf '\n'
-}
-
-
-EXTENSIONS='
-.conf
-.content
-.html
-.snippets
-.htmlbody
-.mapentry
-'
-
-COLL_EXTENSIONS='
-.categoryentry
-.indexentry
-.xmlentry
-'
-
-page_ext_filter="^($(echo "$COLL_EXTENSIONS" |
- tr ' ' '\n' |
- grep . |
- paste -sd'|'
-))\$"
-
-
-extensions() {
- echo "$EXTENSIONS" "$COLL_EXTENSIONS" "$@" |
- tr ' ' '\n' |
- grep .
-}
-
-
-printf '.POSIX:\n\n\n'
-for lang in $(langs); do
- for c in pages $(collections); do
- if [ "$c" = 'pages' ]; then
- filter="$page_ext_filter"
- src='page'
- coll_path=''
- else
- filter='^$'
- src='md'
- coll_path="$(coll2path "$lang" "$c")"
- fi
-
- mds() {
- git ls-files "$CONTENT_PREFIX/$lang/$coll_path"*."$src" |
- sed 's|\.page$|.md|'
- }
-
- exts() {
- extensions | grep -Ev "$filter"
- }
-
- mds | varlist "$c.$lang.md"
- exts | sed "s|^\(.*\)\$|$c.$lang\1 = \$($c.$lang.md:.md=\1)|"
- exts | sed "s|^\(.*\)\$|\$($c.$lang\1)|" | varlist "$c.$lang"
-
- mds | sed 's/^\(.*\)\.md$/\1.mapentry \1.conf \1.content: \1.md/'
- mds | sed 's/^\(.*\)\.md$/\1.categoryentry \1.indexentry \1.html: \1.conf \1.content/'
- mds | sed 's/^\(.*\)\.md$/\1.snippets \1.htmlbody: \1.html/'
- if [ "$c" = 'pages' ]; then
- mds | sed 's|\.md$|\.page|' | varlist "pages.$lang.page"
- mds | sed "s|^\(.*\).md$|\1.md: \1.page|"
- continue
- fi
-
- mds | sed 's/^\(.*\)\.md$/\1.xmlentry: \1.htmlbody/'
-
- echo "$CONTENT_PREFIX/$lang/${coll_path}index.categories: \$($c.$lang.categoryentry)"
- echo "$CONTENT_PREFIX/$lang/${coll_path}index.html: \$($c.$lang.indexentry) $CONTENT_PREFIX/$lang/${coll_path}index.categories"
- echo "$CONTENT_PREFIX/$lang/${coll_path}feed.xml: \$($c.$lang.xmlentry) $CONTENT_PREFIX/$lang/${coll_path}index.categories"
-
- echo "$CONTENT_PREFIX/$lang/${coll_path}index.extrahtml: $CONTENT_PREFIX/$lang/${coll_path}index.html"
- echo "$CONTENT_PREFIX/$lang/${coll_path}index.extrafeeds: $CONTENT_PREFIX/$lang/${coll_path}feed.xml"
-
- echo "$CONTENT_PREFIX/$lang/${coll_path}index.series: \$($c.$lang.conf)"
- echo "\$($c.$lang.html): $CONTENT_PREFIX/$lang/${coll_path}index.series"
-
- printf '\n\n'
- done
-
- coll_path="$(coll2path "$lang" slide)"
- git ls-files "$CONTENT_PREFIX/$lang/$coll_path"*.slides |
- varlist "slide.$lang.slides"
- git ls-files "$CONTENT_PREFIX/$lang/$coll_path"*.slides |
- sed 's/^\(.*\)\.slides$/\1.pdf: \1.ps/'
- printf '\n\n'
-
- echo "slide.$lang.pdf = \$(slide.$lang.slides:.slides=.pdf)"
- echo "all-generated.$lang.slides = \$(slide.$lang.slides)"
- echo "all-generated.$lang.pdf = \$(slide.$lang.pdf)"
-
- for e in $(extensions); do
- {
- if ! printf '%s\n' "$e" | grep -qE "$page_ext_filter"; then
- echo pages
- fi
- collections
- } |
- sed "s|^\(.*\)\$|\$(\1.$lang$e)|" |
- varlist "all-generated.$lang$e"
- done
-
- collections |
- xargs -I% coll2path "$lang" % |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1index.series|" |
- varlist "all-generated.$lang.series"
-
- collections |
- xargs -I% coll2path "$lang" % |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1index.categories|" |
- varlist "all-generated.$lang.categories"
-
- collections |
- xargs -I% coll2path "$lang" % |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1index.extrahtml|" |
- varlist "all-generated.$lang.extrahtml"
-
- collections |
- xargs -I% coll2path "$lang" % |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1index.extrafeeds|" |
- varlist "all-generated.$lang.extrafeeds"
-
- collections |
- xargs -I% coll2path "$lang" % |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1index.html|" |
- varlist "all-generated.$lang.index"
-
- collections |
- xargs -I% coll2path "$lang" % |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1feed.xml|" |
- varlist "all-generated.$lang.xml"
-
- extensions '.series' '.categories' '.extrahtml' '.extrafeeds' '.index' '.xml' '.pdf' |
- sed "s|^\(.*\)\$|\$(all-generated.$lang\1)|" |
- varlist "all-generated.$lang"
-
-
- printf '\n'
-done
-
-
-git ls-files |
- grep '\.uncolored' |
- varlist 'svgs.uncolored'
-# shellcheck disable=2016
-printf 'svgs = $(svgs.uncolored:.uncolored=)\n\n'
-
-
-{
- git ls-files |
- grep '\.page' |
- sed "s|^$CONTENT_PREFIX\(.*\)\.page|\1.md|"
-
- git ls-files |
- grep '\.uncolored' |
- sed "s|^$CONTENT_PREFIX\(.*\)\.uncolored|\1|"
-} > "$CONTENT_PREFIX"/.gitignore
-
-
-for e in $(extensions '.series' '.categories' '.extrahtml' '.extrafeeds' '.index' '.xml' '.pdf'); do
- langs |
- sed "s|^\(.*\)\$|\$(all-generated.\1$e)|" |
- varlist "all-generated$e"
-done
-
-# shellcheck disable=2016
-langs |
- sed 's|^\(.*\)$|$(pages.\1.md)|' |
- varlist 'pages-mds'
-
-# shellcheck disable=2016
-langs |
- sed 's|^\(.*\)$|$(all-generated.\1)|' |
- varlist 'all-generated'
-
-
-git ls-files src/ |
- grep -v ^"$CONTENT_PREFIX"/ |
- varlist 'non-content'
-
-git ls-files "$CONTENT_PREFIX"/ |
- grep -v '\.md$' |
- grep -v '\.page$' |
- grep -v '\.uncolored$' |
- grep -v '\.slides$' |
- grep -v '\.ps$' |
- varlist 'static-content'