From 0b37a66f01884297e0db10e1f8f7c7da6375629e Mon Sep 17 00:00:00 2001 From: Kyle Bowman Date: Sat, 14 Dec 2024 13:09:17 -0500 Subject: [PATCH] feat: add make-demo features --- Makefile | 34 ++++++++++++++++--- {assets => demo/assets}/css/normalize.css | 0 {assets => demo/assets}/css/space-sakura.css | 0 {src/demo => demo/assets}/images/favicon.ico | Bin {src/demo => demo/md}/about.md | 0 {src/demo => demo/md}/acknowledgements.md | 0 {src/demo => demo/md}/demo.md | 0 scripts/index.sh | 4 +-- 8 files changed, 32 insertions(+), 6 deletions(-) rename {assets => demo/assets}/css/normalize.css (100%) rename {assets => demo/assets}/css/space-sakura.css (100%) rename {src/demo => demo/assets}/images/favicon.ico (100%) rename {src/demo => demo/md}/about.md (100%) rename {src/demo => demo/md}/acknowledgements.md (100%) rename {src/demo => demo/md}/demo.md (100%) diff --git a/Makefile b/Makefile index f9d5c5c..2cd9a09 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,7 @@ BUILD_DIR := build SRC_DIR := src BUILD_LIST := $(shell find -L . -path './$(SRC_DIR)/**/*.md' | sed 's:./$(SRC_DIR):$(BUILD_DIR):g' | sed 's:\.md:\.html:g') -.PHONY: all clean help - +.PHONY: help: @echo "Builds HTML files from MD files. Targets include:" @echo @@ -17,12 +16,13 @@ help: @echo " you invoke the make command. The default BUILD_LIST is created from MD files" @echo " found anywhere under the $(SRC_DIR) directory." +.PHONY: all: build/index.html build/index.html: .buildlist xargs -n 1 make --no-print-directory < .buildlist scripts/index.sh > build/index.html - + .buildlist: @echo $(BUILD_LIST) | tr ' ' '\n' > .buildlist @@ -41,6 +41,32 @@ $(BUILD_DIR)/%.html: $(SRC_DIR)/%.md $(BUILD_DIR)/$(ASSETS_DIR) --lua-filter=scripts/links-to-html.lua @echo "Building $@ from $<..." +.PHONY: clean: -rm .buildlist - rm -rf $(BUILD_DIR) \ No newline at end of file + rm -rf $(BUILD_DIR) + +.PHONY: +init-demo: + @if [ -e $(SRC_DIR) ]; then echo "$(SRC_DIR) already exists. Aborting." && exit 1; fi + ln -s demo $(SRC_DIR) + +.PHONY: +init-altdemo: + mkdir -p $(SRC_DIR) + ln -s ../demo/assets $(SRC_DIR)/ + ln -s ../demo/md $(SRC_DIR)/ + +.PHONY: +rm-src: + @if [ ! -z "$(shell find $(SRC_DIR) -not -type 'l' -not -path '$(SRC_DIR)')" ]; then \ + echo "non-link file found in $(SRC_DIR). Aborting." && exit 1; \ + fi + @if [ -L "$(SRC_DIR)" ]; then \ + rm "$(SRC_DIR)" && echo "removing $(SRC_DIR)" ;\ + elif [ -d "$(SRC_DIR)" ]; then \ + find $(SRC_DIR) -type 'l' | xargs rm; \ + rmdir $(SRC_DIR) && echo "removing $(SRC_DIR)";\ + else \ + echo "$(SRC_DIR) is an unhandled type. Aborting."; \ + fi diff --git a/assets/css/normalize.css b/demo/assets/css/normalize.css similarity index 100% rename from assets/css/normalize.css rename to demo/assets/css/normalize.css diff --git a/assets/css/space-sakura.css b/demo/assets/css/space-sakura.css similarity index 100% rename from assets/css/space-sakura.css rename to demo/assets/css/space-sakura.css diff --git a/src/demo/images/favicon.ico b/demo/assets/images/favicon.ico similarity index 100% rename from src/demo/images/favicon.ico rename to demo/assets/images/favicon.ico diff --git a/src/demo/about.md b/demo/md/about.md similarity index 100% rename from src/demo/about.md rename to demo/md/about.md diff --git a/src/demo/acknowledgements.md b/demo/md/acknowledgements.md similarity index 100% rename from src/demo/acknowledgements.md rename to demo/md/acknowledgements.md diff --git a/src/demo/demo.md b/demo/md/demo.md similarity index 100% rename from src/demo/demo.md rename to demo/md/demo.md diff --git a/scripts/index.sh b/scripts/index.sh index 404fbc5..f2a4bd4 100755 --- a/scripts/index.sh +++ b/scripts/index.sh @@ -47,8 +47,8 @@ make_boilerplate(){ Pages in Build - - + +
-- 2.39.5