Files
website/Makefile
2025-05-03 14:43:58 +02:00

39 lines
1.1 KiB
Makefile

.PHONY: all mkdist watch clean
SRC_DIR = src
PAGES_DIR = $(SRC_DIR)/pages
BLOG_DIR = $(SRC_DIR)/blog
DIST_DIR = dist
PAGES = $(notdir $(wildcard $(PAGES_DIR)/*.html))
BLOG_PAGES = $(wildcard $(BLOG_DIR)/*.md)
TARGETS = $(addprefix $(DIST_DIR)/,$(PAGES))
all: $(PAGES_DIR)/blog.html $(TARGETS)
rm -rf $(DIST_DIR)/template.html
watch:
while sleep 1 ; do \
find ./$(SRC_DIR) -iname '*.html' -o -name "*.css" \
| entr -d make -f ./Makefile ; \
done
mkdist:
mkdir -p $(DIST_DIR)
template: $(SRC_DIR)/start.html $(SRC_DIR)/nav.html $(SRC_DIR)/side.html | mkdist
cp -r $(SRC_DIR)/styles $(DIST_DIR)
cat $(SRC_DIR)/start.html $(SRC_DIR)/nav.html $(SRC_DIR)/side.html > dist/template.html
$(PAGES_DIR)/blog.html: $(BLOG_PAGES) $(BLOG_DIR)/start_blog.html $(BLOG_DIR)/end_blog.html
pandoc -f markdown -t html $^ -o $@.tmp
cat $(BLOG_DIR)/start_blog.html $@.tmp $(BLOG_DIR)/end_blog.html > $@
rm $@.tmp
$(DIST_DIR)/%.html: $(PAGES_DIR)/%.html | template mkdist
cat $(DIST_DIR)/template.html $(PAGES_DIR)/$*.html $(SRC_DIR)/end.html > $@
clean:
rm -rf dist
rm -rf $(PAGES_DIR)/blog.html