# --------------------------------------- # Author: David Marsh # --------------------------------------- # # This Makefile is used to generate static blog files for rdm.sh # for usage: make help # more info: make about # # on a mac you'll need the following: # brew install imagemagick graphviz yuicompressor pandoc # # Copyright (C) 2021--2024 David Marsh rdmarsh@gmail.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # MAKE HACKS # --------------------------------------- HASH := \# # FILE EXTENSIONS # --------------------------------------- # change only if needed MD := md CSS := css HTML := html PNG := png JPG := jpg JPEG := jpeg WEBP := webp DOT := dot # WEBSITE SETTINGS # --------------------------------------- # change as needed # site information site_url := rdm.sh site_name := $(site_url) site_owner := david marsh site_desc := doing things the hard way # site assets site_css := _.css site_htm := _.htm site_ico := favicon.png site_img := _$(site_name).webp site_img_alt := A head shot of David, with a greying beard, looking at the camera # date information year_start := 2002 year_current := $(shell date +%Y) date_today := $(shell date +%Y-%m-%d) # license and copyright information site_license := [CC-BY-SA-4.0](http://creativecommons.org/licenses/by-sa/4.0/) site_copyright := ©$(year_start)--$(year_current) [$(site_owner)](https://$(site_url)/about.$(HTML)) $(site_license) # page configuration rec_qty := 9 # number of recent posts to show on the front page page_author := $(site_owner) page_lang := en # site style configuration # uncomment the style you want to use #code_style := breezedark #suits dark #code_style := espresso #suits neither #code_style := haddock #suits light #code_style := kate #suits light code_style := monochrome #suits both #code_style := pygments #suits light #code_style := tango #suits light #code_style := zenburn #suits dark # SOCIAL LINKS # --------------------------------------- # change as needed; escape bare @ and " symbols due to make file social_mastodon := \@davidmarsh mastodon_site := mastodon # NEW PAGE DEFAULTS # --------------------------------------- # change as needed # usage: make new title=foobar title := title subtitle := subtitle slug := $(shell echo $(title) | tr '[:upper:]' '[:lower:]' | tr " " "_") # NAV and FOOTER, USE MD and/or HTML # --------------------------------------- # change as needed; single quotes only site_nav := [home](/index.$(HTML)) site_nav += | [archive](/archive.$(HTML)) site_nav += | [lists](/lists.$(HTML)) site_nav += | [rpg](/rpg.$(HTML)) site_nav += | [howto](/howtos.$(HTML)) site_nav += | [other](/other.$(HTML)) site_nav += | [about](/about.$(HTML)) site_footer := $(site_copyright) site_footer +=
site_footer += $(social_mastodon) on $(mastodon_site) # SPECIAL PAGES # --------------------------------------- # change as needed HTTP_STATUS_PRE := http_status_ ARCHIVE_TITLE := the archive ARCHIVE_SUBTITLE := here there be dragons and broken links LIST_PRE := list_of_ LIST_TITLE := lists and collections LIST_SUBTITLE := keeping track of things RPG_PRE := rpg_ RPG_TITLE := rpg content RPG_SUBTITLE := posts about rpg related stuff #TAG_PRE := tag_ #TAG_TITLE := tags #TAG_SUBTITLE := tags tags tags HOWTO_PRE := howto_ HOWTO_TITLE := how tos HOWTO_SUBTITLE := handy how-tos and tips DRAFT_PRE := draft_ DRAFT_TITLE := drafts DRAFT_SUBTITLE := how did you get here? OTHER_TITLE := other pages OTHER_SUBTITLE := stuff and things # SOURCE DIR and FILENAMES # --------------------------------------- # change only if needed srcdir := _src imgdir := _img #tagdir := _tag bakdir := ../rdmsh_backup # COMPILED HTMLS # --------------------------------------- # change only if needed # gather HTML files for different categories HTML_FILES = $(wildcard *.$(HTML)) LISTS = $(sort $(wildcard $(LIST_PRE)*.$(HTML))) RPGS = $(sort $(wildcard $(RPG_PRE)*.$(HTML))) #TAGS = $(sort $(wildcard $(TAG_PRE)*.$(HTML))) HOWTOS = $(sort $(wildcard $(HOWTO_PRE)*.$(HTML))) DRAFTS = $(sort $(wildcard $(DRAFT_PRE)*.$(HTML))) HTTP_STATUS = $(sort $(wildcard $(HTTP_STATUS_PRE)*.$(HTML))) # find archived HTML files #ARCHIVE = $(shell find * -type f -maxdepth 0 -regex "^[0-9]{4}-[0-9]{2}-[0-9]{2}\..*\.$(HTML)$$" | sort -rn) ARCHIVE = $(shell find * -type f -maxdepth 0 -regex "^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\..*\.$(HTML)$$" | sort -rn) RECENTPOSTS = $(wordlist 1 ,$(rec_qty),$(ARCHIVE)) FILTER = index.$(HTML) archive.$(HTML) lists.$(HTML) rpg.$(HTML) howtos.$(HTML) other.$(HTML) drafts.$(HTML) about.$(HTML) #OTHERS = $(sort $(filter-out $(FILTER) $(ARCHIVE) $(RPGS) $(TAGS) $(LISTS) $(HOWTOS) $(DRAFTS), $(wildcard *.$(HTML)))) OTHERS = $(sort $(filter-out $(FILTER) $(ARCHIVE) $(RPGS) $(LISTS) $(HOWTOS) $(DRAFTS) $(HTTP_STATUS), $(HTML_FILES))) # COMPILE NAV and FOOTER AS HTML # --------------------------------------- # do not change # nav and footer html nav_html := footer_html :=
$(site_footer)
[powered by rdm.sh](https://rdm.sh/powered_by.html)
# include content for the page include_before = $(shell echo "$(nav_html)" | $(PD) --ascii) include_after = $(shell echo "$(footer_html)" | $(PD) --ascii) # EXECUTABLE AND PROGRAM FLAGS # --------------------------------------- # change only if needed # editor to use for new posts EDIT ?= vim #open to last line EDITFLAGS += + # pandoc options for html # note: footnote targets need one blank line between them and href targets PD ?= pandoc PDFLAGS += --verbose PDFLAGS += --from=gfm+tex_math_dollars+footnotes+smart PDFLAGS += --to=html PDFLAGS += --resource-path=$(srcdir) PDFLAGS += --extract-media=$(imgdir) PDFLAGS += --wrap=none PDFLAGS += --standalone #note: uncomment for toc on every page #PDFLAGS += --toc PDFLAGS += --variable=toc-title:"Table of Contents" #note: makes larger files if you have lots of code, disabled with 'no-highlight' #PDFLAGS += --highlight-style=$(code_style) PDFLAGS += --no-highlight PDFLAGS += --ascii #use only ascii in output PDFLAGS += --metadata=lang:'$(page_lang)' PDFLAGS += --metadata=abstract-title: PDFLAGS += --css /$(site_css) PDFLAGS += --template=$(site_htm) PDFLAGS += --variable=include-before:'$(include_before)' PDFLAGS += --variable=include-after:'$(include_after)' PDFLAGS += --variable=author-meta:'$(page_author)' #these are used specifically for our template PDFLAGS += --variable=site_name:'$(site_name)' PDFLAGS += --variable=site_url:'https://$(site_url)' PDFLAGS += --variable=img_url:'https://$(site_url)/$(imgdir)/' PDFLAGS += --variable=site_img:'$(site_img)' PDFLAGS += --variable=site_img_alt:'$(site_img_alt)' # yui css compressor YUI ?= yuicompressor YUFLAGS += --type css # convert binary CON ?= /opt/homebrew/bin/magick # flags for favicon FAVFLAGS += -strip -define icon:auto-resize=64,48,32,16 # flags for webp images WEBPFLAGS += -strip -resize 800x\> JPGFLAGS += -strip -quality 50 PNGFLAGS += -strip -define webp:lossless=true DOTFLAGS += -bordercolor white -border 10 -define webp:lossless=true # python options for local test server SERVER = 127.0.0.1 PORT ?= 8000 PY ?= python3 PYFLAGS += -m http.server PYFLAGS += --bind $(SERVER) $(PORT) # rsync options for push RSYNC ?= rsync RSFLAGS += -avxzc RSFLAGS += --del RSFLAGS += --exclude='.*.swp' #RSFLAGS += --exclude='$(srcdir)/' RSFLAGS += --delete-excluded # tell os to open browser (mac only afaik) BROWSER := open # BUILD SOURCE AND TARGTS # --------------------------------------- # do not change MDSOURCES := $(wildcard $(srcdir)/*.$(MD)) #TAGSOURCES := $(wildcard $(tagdir)/*.$(MD)) PNGSOURCES := $(wildcard $(srcdir)/*.$(PNG)) JPGSOURCES := $(wildcard $(srcdir)/*.$(JPG)) JPGSOURCES += $(wildcard $(srcdir)/*.$(JPEG)) DOTSOURCES := $(wildcard $(srcdir)/*.$(DOT)) # Generate targets for each type HTMTARGETS := $(patsubst $(srcdir)/%.$(MD),%.$(HTML),$(MDSOURCES)) #TAGTARGETS := $(patsubst $(tagdir)/%.$(MD),%.$(HTML),$(TAGSOURCES)) PNGTARGETS := $(PNGSOURCES:.$(PNG)=.$(WEBP)) JPGTARGETS := $(JPGSOURCES:.$(JPG)=.$(WEBP)) JPGTARGETS += $(JPGSOURCES:.$(JPEG)=.$(WEBP)) DOTTARGETS += $(DOTSOURCES:.$(DOT)=.$(WEBP)) # TARGETS # --------------------------------------- # do not change .PHONY: all all: images tidy robots siteimg favicon ## Build everything +$(MAKE) pages +$(MAKE) index archive lists rpg howtos other drafts +$(MAKE) sitemap # +$(MAKE) index archive lists rpg tag howtos other drafts # +$(MAKE) tags .PHONY: typos pages pages: $(HTMTARGETS) ## Build markdown pages #.PHONY: tags #tags: $(TAGTARGETS) ## Build tag pages .PHONY: images images: $(PNGTARGETS) $(JPGTARGETS) $(DOTTARGETS) ## Build images .PHONY: push push: tidy ## Push site to prod via rsync $(RSYNC) $(RSFLAGS) . $(site_url):$(site_url) .PHONY: test test: ## Start local test server $(PY) $(PYFLAGS) .PHONY: open open: ## Open main page in browser $(BROWSER) http://$(SERVER):$(PORT)/ .PHONY: typos typos: ## Check for common typos ! grep "wepb" $(MDSOURCES) .PHONY: back back: tidy | $(bakdir) ## TAR and backup (eg ../backup/site.YYYY-MM-DD.tar.gz) tar -cvf $(bakdir)/$(site_url).$(date_today).tar.gz . $(bakdir): mkdir -p $@ .PHONY: clean clean: tidy ## Remove all generated files $(RM) $(site_css) $(RM) $(site_htm) $(RM) $(imgdir)/* $(RM) $(srcdir)/*.$(WEBP) # $(RM) $(tagdir)/* $(RM) favicon.ico $(RM) robots.txt $(RM) sitemap.txt $(RM) sitemap.xml $(RM) feed.json $(RM) *.$(HTML) .PHONY: tidy tidy: nomac ## Tidy extra files $(RM) .*.swo $(RM) .*.swp $(RM) $(srcdir)/.*.swo $(RM) $(srcdir)/.*.swp .PHONY: nomac nomac: ## Tidy mac files $(RM) .DS_Store $(RM) $(srcdir)/.DS_Store $(RM) $(imgdir)/.DS_Store # $(RM) $(tagdir)/.DS_Store $(RM) $(bakdir)/.DS_Store ######################################## ### ### index ### ######################################## .PHONY: index index: index.$(HTML) ## Build index files INDEX_TEXT = '---\ \ntitle: $(site_name)\ \nsubtitle: $(site_desc)\ \n---\ \n\ \n$(shell echo $(RECENTPOSTS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/_/, " ", $$2) ; print "\\n* " $$1 " -- [" $$2 "](" file ")"}')\ \n
*[everything...](/archive.$(HTML))*\ ' # \n\ # \n$(TABLE_TITLE)\ # \n-------------\ # \n$(shell echo $(TABLES) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(TABLE_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ # \n\ # \n$(LIST_TITLE)\ # \n-------------\ # \n$(shell echo $(LISTS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(LIST_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ # \n\ # \n$(RPG_TITLE)\ # \n------------\ # \n$(shell echo $(RPGS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(RPG_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ # \n\ # \n$(REVIEW_TITLE)\ # \n---------------\ # \n$(shell echo $(REVIEWS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(REVIEW_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ # \n\ #index.$(HTML): $(RECENTPOSTS) $(LISTS) $(RPGS) $(OTHERS) $(MAKEFILE_LIST) index.$(HTML): $(RECENTPOSTS) $(MAKEFILE_LIST) echo $(INDEX_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### archive ### ######################################## .PHONY: archive archive: archive.$(HTML) ## Build archive page ACHIVE_TEXT = '---\ \ntitle: $(ARCHIVE_TITLE)\ \nsubtitle: $(ARCHIVE_SUBTITLE)\ \n---\ \n\ \n$(shell echo $(ARCHIVE) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/_/, " ", $$2) ; print "\\n* " $$1 " -- [" $$2 "](" file ")"}')\ ' archive.$(HTML): $(ARCHIVE) $(MAKEFILE_LIST) echo $(ACHIVE_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### lists ### ######################################## .PHONY: lists lists: lists.$(HTML) ## Build list page LISTS_TEXT = '---\ \ntitle: $(LIST_TITLE)\ \nsubtitle: $(LIST_SUBTITLE)\ \n---\ \n\ \n$(shell echo $(LISTS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(LIST_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ ' lists.$(HTML): $(LISTS) $(MAKEFILE_LIST) echo $(LISTS_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### rpg ### ######################################## .PHONY: rpg rpg: rpg.$(HTML) ## Build rpg page RPG_TEXT = '---\ \ntitle: $(RPG_TITLE)\ \nsubtitle: $(RPG_SUBTITLE)\ \n---\ \n\ \n$(shell echo $(RPGS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(RPG_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ ' rpg.$(HTML): $(RPGS) $(MAKEFILE_LIST) echo $(RPG_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### tag ### ######################################## # #.PHONY: tag #tag: tag.$(HTML) ## Build tag page # #TAG_TEXT = '---\ # \ntitle: $(TAG_TITLE)\ # \nsubtitle: $(TAG_SUBTITLE)\ # \n---\ # \n\ # \n$(shell echo $(TAGS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(TAG_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ # ' # #tag.$(HTML): $(TAGS) $(MAKEFILE_LIST) # echo $(TAG_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### howtos ### ######################################## .PHONY: howtos howtos: howtos.$(HTML) ## Build howtos page HOWTOS_TEXT = '---\ \ntitle: $(HOWTO_TITLE)\ \nsubtitle: $(HOWTO_SUBTITLE)\ \n---\ \n\ \n$(shell echo $(HOWTOS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(HOWTO_PRE)/, "", $$1) ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ ' howtos.$(HTML): $(HOWTOS) $(MAKEFILE_LIST) echo $(HOWTOS_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### drafts ### ######################################## .PHONY: drafts drafts: drafts.$(HTML) ## Build drafts page DRAFTS_TEXT = '---\ \ntitle: $(DRAFT_TITLE)\ \nsubtitle: $(DRAFT_SUBTITLE)\ \n---\ \n\ \n$(shell echo $(DRAFTS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/$(DRAFT_PRE)/, "", $$1) ; gsub(/_/, " ", $$2) ; print "\\n* " $$1 " -- [" $$2 "](" file ")"}')\ ' drafts.$(HTML): $(DRAFTS) $(MAKEFILE_LIST) echo $(DRAFTS_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### other ### ######################################## .PHONY: other other: other.$(HTML) ## Build other page OTHER_TEXT = '---\ \ntitle: $(OTHER_TITLE)\ \nsubtitle: $(OTHER_SUBTITLE)\ \n---\ \n\ \n$(shell echo $(OTHERS) | tr " " "\n" | awk 'BEGIN{FS="."} {file=$$0 ; gsub(/_/, " ", $$1) ; print "\\n* [" $$1 "](" file ") "}')\ ' other.$(HTML): $(OTHERS) $(MAKEFILE_LIST) echo $(OTHER_TEXT) | $(PD) $(PDFLAGS) $(OUTPUT_OPTION) ######################################## ### ### meta files ### ######################################## $(site_css): $(srcdir)/_$(site_url).$(CSS) $(MAKEFILE_LIST) $(YUI) $(YUFLAGS) $< $(OUTPUT_OPTION) $(site_htm): $(srcdir)/_$(site_url).htm $(MAKEFILE_LIST) cp -f $< $@ .PHONY: favicon favicon: favicon.ico ## Build favicon file favicon.ico: $(srcdir)/$(site_ico) $(MAKEFILE_LIST) $(CON) $< $(FAVFLAGS) $@ .PHONY: siteimg siteimg: $(imgdir)/$(site_img) ## Build default site image file $(imgdir)/$(site_img): $(srcdir)/$(site_img) cp -f $< $@ .PHONY: sitemap sitemap: sitemap.txt sitemap.xml ## Build sitemap files sitemap.txt: $(ARCHIVE) $(MAKEFILE_LIST) ls *.$(HTML) | grep -vE 'test.$(HTML)|drafts.$(HTML)|$(DRAFT_PRE)|$(HTTP_STATUS_PRE)' | sort | sed 's,^,https://$(site_url)/,' > $@ sitemap.xml: $(ARCHIVE) $(MAKEFILE_LIST) echo '' > $@ ls *.$(HTML) | grep -vE 'test.$(HTML)|drafts.$(HTML)|$(DRAFT_PRE)|$(HTTP_STATUS_PRE)' | sort | sed -e 's,^,https://$(site_url)/,' -e 's,$$,,' >> $@ echo '' >> $@ .PHONY: robots robots: robots.txt ## Build robots file # \ndisallow: /test.$(HTML)\ ROBOTS_TEXT = 'User-Agent: *\ \nallow: /\ \nallow: /_mirror/\ \ndisallow: /drafts.$(HTML)\ \ndisallow: /$(DRAFT_PRE)*.$(HTML)\ \ndisallow: /$(HTTP_STATUS_PRE)*.$(HTML)\ \nDisallow: /?p=*\ \n\ \nSitemap: https://$(site_url)/sitemap.xml\ \n\ \nCrawl-delay: 30\ ' robots.txt: $(MAKEFILE_LIST) echo $(ROBOTS_TEXT) > $@ .PHONY: rss rss: feed.json ## Build rss feeds feed.json: $(MAKEFILE_LIST) echo '{\ \n "version": "https://jsonfeed.org/version/1.1",\ \n "title": "$(site_name)",\ \n "home_page_url": "https://$(site_url)/",\ \n "feed_url": "https://$(site_url)/feed.json",\ \n "description": "$(site_desc)",\ \n "icon": "https://$(site_url)/$(imgdir)/$(site_img)",\ \n "favicon": "https://$(site_url)/favicon.ico",\ \n {\ \n "id": "2",\ \n todo dave you are up to here \ \n ]\ \n ]\ \n}\ ' > $@ $(srcdir)/%.$(WEBP): $(srcdir)/%.$(JPG) $(MAKEFILE_LIST) $(CON) $< $(JPGFLAGS) $(WEBPFLAGS) $@ $(srcdir)/%.$(WEBP): $(srcdir)/%.$(JPEG) $(MAKEFILE_LIST) $(CON) $< $(JPGFLAGS) $(WEBPFLAGS) $@ $(srcdir)/%.$(WEBP): $(srcdir)/%.$(PNG) $(MAKEFILE_LIST) $(CON) $< $(PNGFLAGS) $(WEBPFLAGS) $@ $(srcdir)/%.$(WEBP): $(srcdir)/%.$(DOT) $(MAKEFILE_LIST) $(CON) $< $(DOTFLAGS) $(WEBPFLAGS) $@ ######################################## ### ### new post ### ######################################## .PHONY: new new: $(srcdir)/$(DRAFT_PRE)$(date_today).$(slug).$(MD) ## Create a draft post and open for editing (eg make new title="foo bar") $(EDIT) $(EDITFLAGS) $< NEW_POST = '---\ \ntitle: $(title)\ \nsubtitle: $(subtitle)\ \nauthor: $(page_author)\ \ndate: $(date_today)\ \nkeywords: [keyword1, keyword2]\ \nimg: image.wepb\ \nalt: alt image description\ \nabstract: an abstract all on one line, limit to 200 chars\ \n---\ \n\ \ndont forget to remove "$(DRAFT_PRE)" and rename as appropriate to publish:\ \n\ \n $(srcdir)/$(DRAFT_PRE)$(date_today).$(slug).$(MD)\ \n\ \n\ ' $(srcdir)/$(DRAFT_PRE)$(date_today).$(slug).$(MD): echo $(NEW_POST) > $@ # $(shell echo hi | tee -a $(yq eval --front-matter=extract '.keywords[] | sub("\s+"; "_") | "tag_" + . + ".md"' $(tagdir)/$<)) # $(shell yq eval --front-matter=extract '.keywords[] | sub("\s+"; "_") | "tag_" + . + ".md"' $(tagdir)/$<) ; do #note: below will find 'toc: false' which shouldn't have a toc # $(eval $@_PREVIEW := $(shell if grep -Eq "^preview:\s*\w+$$" $< ; then echo '--metadata header-includes:' ; fi)) # $(eval $PDFLAGS += --variable=page-url:'https://$(site_url)/$@') %.$(HTML): $(srcdir)/%.$(MD) $(site_css) $(site_htm) $(MAKEFILE_LIST) $(eval $@_TOC := $(shell if grep -Eq "^toc:\s*\w+$$" $< ; then echo '--toc' ; fi)) $(PD) $(PDFLAGS) $($@_TOC) $< $(OUTPUT_OPTION) #there is a quote here to fix vim colouring' # for tag in $(shell yq eval --front-matter=extract '.keywords[] | sub("\s+"; "_") | "tag_" + . + ".md"' $< | tr "[:upper:]" "[:lower:]") ; do \ # echo $@ | awk 'BEGIN{FS="."} ; {file=$$0 ; gsub(/_/, " ", $$1) ; print "* [" $$1 "](" file ") "}' >> $(tagdir)/$$tag ; \ # sort -uo $(tagdir)/$$tag $(tagdir)/$$tag ; \ # done #%.$(HTML): $(tagdir)/%.$(MD) $(MAKEFILE_LIST) # $(PD) $(PDFLAGS) $< $(OUTPUT_OPTION) #there is a quote here to fix vim colouring' .PHONY: about about: ## About this Makefile @echo @echo 'This Makefile is used to generate static blog files for $(site_url)' @echo @echo 'Edit this Makefile to change paramaters eg, site_url, site_name, etc' @echo @echo 'Put your Markdown files in $(srcdir):' @echo ' - Do not use spaces in filenames, use underscores' @echo ' - Post filename format with YYYY-MM-DD.x.$(MD)' @echo ' - List filename format $(LIST_PRE)x.$(MD)' @echo ' - RPG filename format $(RPG_PRE)x.$(MD)' @echo ' - How to filename format $(HOWTO_PRE)x.$(MD)' # @echo ' - Table filename format $(TABLE_PRE)x.$(MD)' # @echo ' - Review filename format $(REVIEW_PRE)x.$(MD)' # @echo ' - Links page filename is links.md' @echo ' - Other page filename format is anything else' @echo ' - About page filename is about.md' @echo @echo 'Run "make help" to for how to run' @echo .PHONY: copy copy: ## Copyright notice @echo @echo 'Copyright (C) 2021--2024 David Marsh' @echo 'rdmarsh@gmail.com https://rdm.sh/powered_by.html' @echo @echo 'This program is free software: you can redistribute it and/or modify' @echo 'it under the terms of the GNU General Public License as published by' @echo 'the Free Software Foundation, either version 3 of the License, or' @echo '(at your option) any later version.' @echo @echo 'This program comes with ABSOLUTELY NO WARRANTY.' @echo 'This is free software, and you are welcome to redistribute it' @echo 'under certain conditions. View the file "LICENSE" for details.' @echo .PHONY: help help: ## Show this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage: make [flags] [option]\n"} /^[$$()% \.0-9a-zA-Z_-]+:.*?##/ { printf " \033[36mmake %-12s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) @echo @echo 'Useful make flags:' @echo ' make -n : dry run' @echo ' make -j : run simultaneous jobs' @echo ' make -B : force make target' @echo @echo 'You can override Makefile vars like so:' @echo ' make site_css=pandoc.css' @echo