From 4883eebbbf4d0babef1b9140a18be3d007ca1efc Mon Sep 17 00:00:00 2001 From: Cullum Smith Date: Wed, 3 Jul 2024 12:32:53 -0400 Subject: cleanup makefile --- Makefile | 91 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index d079cf8..4271951 100644 --- a/Makefile +++ b/Makefile @@ -9,53 +9,50 @@ RECENT_POSTS_LIMIT = 5 ### VARIABLES ###################### -SOURCE_DIR = src -OUTPUT_DIR = public -SCRIPT_DIR = scripts - -BLOG_DIR = blog - -TEMPLATE = templates/default.html -CV_TEMPLATE = templates/cv.html -DEFAULTS = defaults.yaml - -BLOG_LIST_SCRIPT = ${SCRIPT_DIR}/bloglist.py -BLOG_LIST_REPLACE = __BLOG_LIST__ -BLOG_LIST_FILE = .bloglist.md - -BLOG_RSS_SCRIPT = ${SCRIPT_DIR}/rss.py -BLOG_RSS_FILE = ${BLOG_DIR}/feed.xml - -SOURCE_DIRS != find ${SOURCE_DIR} -mindepth 1 -type d -SOURCE_HOMEPAGE := ${SOURCE_DIR}/index.md -SOURCE_BLOGLIST := ${SOURCE_DIR}/${BLOG_DIR}/index.md -SOURCE_CV := ${SOURCE_DIR}/cv/index.md -SOURCE_SPECIAL := ${SOURCE_HOMEPAGE} ${SOURCE_BLOGLIST} ${SOURCE_CV} -SOURCE_MARKDOWN != find ${SOURCE_DIR} -type f -name '*.md' ! -name ${BLOG_LIST_FILE} ${SOURCE_SPECIAL:C/^/! -path /} -SOURCE_STATIC != find -E ${SOURCE_DIR} -type f -iregex ${STATIC_REGEX:Q} - -BLOG_POSTS != find ${SOURCE_DIR}/${BLOG_DIR} -type f -name '*.md' ! -name ${BLOG_LIST_FILE} ! -path ${SOURCE_DIR}/${BLOG_DIR}/index.md -RECENT_POST_LIST = ${SOURCE_DIR}/${BLOG_LIST_FILE} -FULL_POST_LIST = ${SOURCE_DIR}/${BLOG_DIR}/${BLOG_LIST_FILE} - -SOURCE2OUTPUT = S/^${SOURCE_DIR}\//${OUTPUT_DIR}\// -SOURCE2HTML = ${SOURCE2OUTPUT}:S/.md$$/.html/ -OUTPUT2SOURCE = S/^${OUTPUT_DIR}\//${SOURCE_DIR}\// -HTML2SOURCE = ${OUTPUT2SOURCE}:S/.html$$/.md/ - -OUTPUT_DIRS := ${SOURCE_DIRS:${SOURCE2OUTPUT}} -OUTPUT_HOMEPAGE := ${SOURCE_HOMEPAGE:${SOURCE2HTML}} -OUTPUT_BLOGLIST := ${SOURCE_BLOGLIST:${SOURCE2HTML}} -OUTPUT_CV := ${SOURCE_CV:${SOURCE2HTML}} -OUTPUT_SPECIAL := ${SOURCE_SPECIAL:${SOURCE2HTML}} -OUTPUT_MARKDOWN := ${SOURCE_MARKDOWN:${SOURCE2HTML}} -OUTPUT_STATIC := ${SOURCE_STATIC:${SOURCE2OUTPUT}} -OUTPUT_RSS := ${OUTPUT_DIR}/${BLOG_RSS_FILE} +SOURCE_DIR = src +OUTPUT_DIR = public +SCRIPT_DIR = scripts +BLOG_DIR = blog + +TEMPLATE = templates/default.html +CV_TEMPLATE = templates/cv.html +DEFAULTS = defaults.yaml + +BLOG_LIST_SCRIPT = ${SCRIPT_DIR}/bloglist.py +BLOG_LIST_REPLACE = __BLOG_LIST__ +BLOG_LIST_FILE = .bloglist.md + +BLOG_RSS_SCRIPT = ${SCRIPT_DIR}/rss.py +BLOG_RSS_FILE = ${BLOG_DIR}/feed.xml + +SOURCE_DIRS != find ${SOURCE_DIR} -mindepth 1 -type d +SOURCE_HOMEPAGE := ${SOURCE_DIR}/index.md +SOURCE_BLOGLIST := ${SOURCE_DIR}/${BLOG_DIR}/index.md +SOURCE_CV := ${SOURCE_DIR}/cv/index.md +SOURCE_SPECIAL := ${SOURCE_HOMEPAGE} ${SOURCE_BLOGLIST} ${SOURCE_CV} +SOURCE_MARKDOWN != find ${SOURCE_DIR} -type f -name '*.md' ! -name ${BLOG_LIST_FILE} ${SOURCE_SPECIAL:C/^/! -path /} +SOURCE_STATIC != find -E ${SOURCE_DIR} -type f -iregex ${STATIC_REGEX:Q} + +BLOG_POSTS != find ${SOURCE_DIR}/${BLOG_DIR} -type f -name '*.md' ! -name ${BLOG_LIST_FILE} ! -path ${SOURCE_BLOGLIST} +RECENT_POST_LIST = ${SOURCE_DIR}/${BLOG_LIST_FILE} +FULL_POST_LIST = ${SOURCE_DIR}/${BLOG_DIR}/${BLOG_LIST_FILE} + +SOURCE2OUTPUT = S/^${SOURCE_DIR}\//${OUTPUT_DIR}\// +SOURCE2HTML = ${SOURCE2OUTPUT}:S/.md$$/.html/ +OUTPUT2SOURCE = S/^${OUTPUT_DIR}\//${SOURCE_DIR}\// +HTML2SOURCE = ${OUTPUT2SOURCE}:S/.html$$/.md/ + +OUTPUT_DIRS := ${SOURCE_DIRS:${SOURCE2OUTPUT}} +OUTPUT_HOMEPAGE := ${SOURCE_HOMEPAGE:${SOURCE2HTML}} +OUTPUT_BLOGLIST := ${SOURCE_BLOGLIST:${SOURCE2HTML}} +OUTPUT_CV := ${SOURCE_CV:${SOURCE2HTML}} +OUTPUT_SPECIAL := ${SOURCE_SPECIAL:${SOURCE2HTML}} +OUTPUT_MARKDOWN := ${SOURCE_MARKDOWN:${SOURCE2HTML}} +OUTPUT_STATIC := ${SOURCE_STATIC:${SOURCE2OUTPUT}} +OUTPUT_RSS := ${OUTPUT_DIR}/${BLOG_RSS_FILE} ### BUILD COMMANDS ###################### -.SHELL: name=sh quiet="set -" echo="set -v" filter="set -" hasErrCtl=yes check="set -eo pipefail" ignore="set +e" echoFlag=v errFlag=e path=/bin/sh - COPY = cp -p PANDOC := pandoc \ @@ -71,11 +68,13 @@ GENERATE_RSS := ${BLOG_RSS_SCRIPT} \ --blog-path=/${BLOG_DIR} \ --feed-path=/${BLOG_RSS_FILE} -GENERATE_BLOGLIST := ${BLOG_LIST_SCRIPT} ${SOURCE_DIR}/${BLOG_DIR} -INTERPOLATE_BLOGLIST = sed -e '/${BLOG_LIST_REPLACE}/{r ${BLOGLIST_HTML}' -e 'd;}' +GENERATE_BLOGLIST := ${BLOG_LIST_SCRIPT} ${SOURCE_DIR}/${BLOG_DIR} +INTERPOLATE_BLOGLIST = sed -e '/${BLOG_LIST_REPLACE}/{r ${BLOGLIST_HTML}' -e 'd;}' ### TARGETS ###################### +.SHELL: name=sh quiet="set -" echo="set -v" filter="set -" hasErrCtl=yes check="set -eo pipefail" ignore="set +e" echoFlag=v errFlag=e path=/bin/sh + public: ${OUTPUT_DIRS} ${OUTPUT_SPECIAL} ${OUTPUT_MARKDOWN} ${OUTPUT_STATIC} ${OUTPUT_RSS} ${OUTPUT_DIRS}: -- cgit v1.2.3