2022-03-21 15:08:38 +01:00
|
|
|
SITE_NAME = ktyl.dev
|
|
|
|
# configured in ~/.ssh/config
|
|
|
|
HOST = pluto
|
|
|
|
# a script on the remote server to move it on arrival
|
|
|
|
REMOTE_SCRIPT = ./deploy-$(SITE_NAME)
|
|
|
|
|
2021-09-13 01:06:53 +02:00
|
|
|
SRC_DIR = src
|
2021-10-11 01:29:58 +02:00
|
|
|
IMG_DIR = img
|
2021-09-13 01:06:53 +02:00
|
|
|
OUT_DIR = site
|
|
|
|
|
|
|
|
ROOT_DIR = $(SRC_DIR)/root
|
|
|
|
|
2023-03-11 13:20:04 +01:00
|
|
|
BLOG_BASE_DIR = blog/
|
|
|
|
BLOG_BUILD_DIR = $(BLOG_BASE_DIR)out/html/
|
|
|
|
BLOG_SRC_DIR = $(BLOG_BASE_DIR)blogs
|
2022-01-05 01:54:43 +01:00
|
|
|
BLOG_OUT_DIR = $(OUT_DIR)/blog
|
|
|
|
BLOG_TMP_DIR = .blogtmp
|
|
|
|
|
2021-09-13 01:06:53 +02:00
|
|
|
PAGES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.html")
|
|
|
|
STYLES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.css")
|
2022-01-05 01:54:43 +01:00
|
|
|
BLOG_PAGES = $(shell find $(BLOG_SRC_DIR) -wholename "$(BLOG_SRC_DIR)*.md")
|
2022-12-15 21:14:09 +01:00
|
|
|
BLOG_IMAGES = $(shell find $(BLOG_SRC_DIR) -wholename "$(BLOG_SRC_DIR)*.png" -o -wholename "$(BLOG_SRC_DIR)*.jpg")
|
2021-10-11 01:29:58 +02:00
|
|
|
|
|
|
|
IMAGES = $(shell find $(IMG_DIR) -wholename "$(IMG_DIR)/*.png")
|
|
|
|
|
|
|
|
HTML_INCLUDES = $(shell find $(SRC_DIR)/inc_html -name *.html)
|
|
|
|
CSS_INCLUDES = $(shell find $(SRC_DIR)/inc_css -name *.css)
|
|
|
|
|
2022-01-05 01:54:43 +01:00
|
|
|
BLOG_INDEX = $(OUT_DIR)/blog.html
|
2022-06-03 17:12:32 +02:00
|
|
|
BLOG_RSS = $(BLOG_OUT_DIR)/index.xml
|
2022-01-05 01:54:43 +01:00
|
|
|
BLOG_INDEX_LINKS = $(BLOG_TMP_DIR)/blogindexlinks.html
|
|
|
|
BLOG_TARGETS = $(BLOG_PAGES:$(BLOG_SRC_DIR)/%.md=$(BLOG_OUT_DIR)/%.html)
|
2022-12-15 21:14:09 +01:00
|
|
|
BLOG_PNG_TARGETS = $(BLOG_IMAGES:$(BLOG_SRC_DIR)/%.png=$(BLOG_OUT_DIR)/%.png)
|
|
|
|
BLOG_JPG_TARGETS = $(BLOG_IMAGES:$(BLOG_SRC_DIR)/%.jpg=$(BLOG_OUT_DIR)/%.jpg)
|
2022-01-05 01:54:43 +01:00
|
|
|
|
2021-10-11 01:29:58 +02:00
|
|
|
HTML_TARGETS = $(PAGES:$(ROOT_DIR)/%.html=$(OUT_DIR)/%.html)
|
2021-09-13 01:06:53 +02:00
|
|
|
CSS_TARGETS = $(STYLES:$(ROOT_DIR)/%.css=$(OUT_DIR)/%.css)
|
2021-10-11 01:29:58 +02:00
|
|
|
PNG_TARGETS = $(IMG_DIR)/%.png=$(OUT_DIR)/%.png
|
2021-09-13 01:06:53 +02:00
|
|
|
|
2022-03-29 23:52:38 +02:00
|
|
|
|
2022-12-24 19:38:21 +01:00
|
|
|
all: html blog | $(OUT_DIR)
|
|
|
|
|
|
|
|
html: $(HTML_TARGETS) $(CSS_TARGETS) | $(OUT_DIR)
|
2021-10-11 01:29:58 +02:00
|
|
|
cp $(IMG_DIR)/*.png $(OUT_DIR)/
|
2022-06-04 20:33:35 +02:00
|
|
|
cp $(IMG_DIR)/*.jpg $(OUT_DIR)/
|
2021-09-13 01:06:53 +02:00
|
|
|
|
2022-03-21 15:08:38 +01:00
|
|
|
deploy: site
|
|
|
|
cp -r $(OUT_DIR) $(SITE_NAME)
|
|
|
|
rsync -rP $(SITE_NAME) $(HOST):~
|
|
|
|
rm -r $(SITE_NAME)
|
|
|
|
ssh $(HOST) "sudo $(REMOTE_SCRIPT)"
|
|
|
|
|
2022-05-27 02:33:00 +02:00
|
|
|
$(OUT_DIR)/%.html: $(ROOT_DIR)/%.html $(HTML_INCLUDES) $(BLOG_INDEX_LINKS) | $(OUT_DIR)
|
|
|
|
python ppp/ppp.py $< $(HTML_INCLUDES) $(BLOG_INDEX_LINKS) > $@
|
2021-09-13 01:06:53 +02:00
|
|
|
|
2022-06-03 17:12:32 +02:00
|
|
|
$(OUT_DIR)/%.css: $(ROOT_DIR)/%.css $(CSS_INCLUDES) | $(OUT_DIR)
|
|
|
|
python ppp/ppp.py $< $(CSS_INCLUDES) > $@
|
2022-01-05 01:54:43 +01:00
|
|
|
|
2022-06-03 17:12:32 +02:00
|
|
|
$(OUT_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
2022-12-15 21:14:09 +01:00
|
|
|
$(BLOG_OUT_DIR)/%.png: $(BLOG_SRC_DIR)/%.png
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
$(BLOG_OUT_DIR)/%.jpg: $(BLOG_SRC_DIR)/%.jpg
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
blog: $(BLOG_TARGETS) $(BLOG_PNG_TARGETS) $(BLOG_JPG_TARGETS) $(BLOG_RSS) | $(BLOG_TMP_DIR)
|
2022-06-03 17:12:32 +02:00
|
|
|
|
2023-03-11 13:20:04 +01:00
|
|
|
$(BLOG_RSS):
|
|
|
|
make --directory $(BLOG_BASE_DIR) html
|
|
|
|
cp $(BLOG_BUILD_DIR)/index.xml $@
|
2022-01-05 01:54:43 +01:00
|
|
|
|
|
|
|
$(BLOG_INDEX_LINKS): $(BLOG_TARGETS) | $(BLOG_TMP_DIR)
|
2023-03-11 14:35:00 +01:00
|
|
|
make --directory $(BLOG_BASE_DIR) html
|
|
|
|
cp $(BLOG_BUILD_DIR)/index.html $@
|
2022-01-05 01:54:43 +01:00
|
|
|
|
|
|
|
$(BLOG_OUT_DIR)/%.html: $(BLOG_OUT_DIR)/%.html.tmp $(HTML_INCLUDES) $(CSS_TARGETS)
|
|
|
|
python ppp/ppp.py $< $(HTML_INCLUDES) > $@
|
|
|
|
cp $(CSS_TARGETS) `dirname $@`
|
|
|
|
rm $<
|
|
|
|
|
|
|
|
$(BLOG_OUT_DIR)/%.html.tmp: $(BLOG_SRC_DIR)/%.md | $(BLOG_TMP_DIR)
|
2022-09-27 09:32:11 +02:00
|
|
|
pipenv run python scripts/mkblog.py $< $@
|
2022-01-05 01:54:43 +01:00
|
|
|
|
|
|
|
$(BLOG_OUT_DIR): | $(OUT_DIR)
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
$(BLOG_TMP_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUT_DIR) $(BLOG_TMP_DIR)
|
2022-03-21 15:08:38 +01:00
|
|
|
|
|
|
|
.PHONY: site
|