2022-04-16 20:46:09 +02:00
|
|
|
SRC_DIR = ./blogs
|
|
|
|
OUT_DIR = out/
|
|
|
|
HTML_DIR = $(OUT_DIR)html
|
|
|
|
GEMINI_DIR = $(OUT_DIR)gemini
|
|
|
|
|
2023-03-11 14:29:39 +01:00
|
|
|
MAKE_GEMINI = build/markdown2gemini.py
|
2023-03-13 00:19:55 +01:00
|
|
|
MAKE_HTML = build/page.py
|
2023-03-11 14:29:39 +01:00
|
|
|
MAKE_RSS = build/rss.py
|
|
|
|
MAKE_HTML_INDEX = build/index.py
|
2022-04-16 20:46:09 +02:00
|
|
|
|
|
|
|
PAGES = $(shell find $(SRC_DIR) -wholename "$(BLOG_SRC_DIR)*.md")
|
|
|
|
|
|
|
|
HTML_TARGETS = $(PAGES:$(SRC_DIR)/%.md=$(HTML_DIR)/%.html)
|
2023-03-11 13:16:38 +01:00
|
|
|
HTML_RSS = $(HTML_DIR)/index.xml
|
2023-03-11 14:29:39 +01:00
|
|
|
HTML_INDEX = $(HTML_DIR)/index.html
|
|
|
|
|
2022-04-16 20:46:09 +02:00
|
|
|
GEMINI_TARGETS = $(PAGES:$(SRC_DIR)/%.md=$(GEMINI_DIR)/%.gmi)
|
|
|
|
|
2023-03-13 00:19:55 +01:00
|
|
|
IMAGES = $(shell find $(SRC_DIR) -wholename "$(SRC_DIR)*.png" -o -wholename "$(SRC_DIR)*.jpg")
|
|
|
|
PNG_TARGETS = $(IMAGES:$(SRC_DIR)/%.png=$(HTML_DIR)/%.png)
|
|
|
|
JPG_TARGETS = $(IMAGES:$(SRC_DIR)/%.jpg=$(HTML_DIR)/%.jpg)
|
|
|
|
IMAGE_TARGETS = $(PNG_TARGETS) $(JPG_TARGETS)
|
|
|
|
|
2022-04-16 20:46:09 +02:00
|
|
|
_dummy := $(shell mkdir -p $(HTML_DIR) $(GEMINI_DIR))
|
|
|
|
|
|
|
|
$(HTML_DIR)/%.html: $(SRC_DIR)/%.md
|
2023-03-11 14:29:39 +01:00
|
|
|
pipenv run python $(MAKE_HTML) $< $@
|
2022-04-16 20:46:09 +02:00
|
|
|
|
2023-03-11 13:16:38 +01:00
|
|
|
$(HTML_RSS): $(PAGES)
|
|
|
|
pipenv run python $(MAKE_RSS) $(PAGES) > $@
|
|
|
|
|
2023-03-11 14:29:39 +01:00
|
|
|
$(HTML_INDEX): $(HTML_TARGETS)
|
|
|
|
pipenv run python $(MAKE_HTML_INDEX) $(HTML_TARGETS) > $@
|
|
|
|
|
|
|
|
$(HTML_DIR)/%.png: $(SRC_DIR)/%.png
|
|
|
|
mkdir -p $(shell dirname $@)
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
$(HTML_DIR)/%.jpg: $(SRC_DIR)/%.jpg
|
|
|
|
mkdir -p $(shell dirname $@)
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
html: $(HTML_TARGETS) $(HTML_RSS) $(HTML_INDEX) $(IMAGE_TARGETS)
|
2022-04-16 20:46:09 +02:00
|
|
|
|
|
|
|
gemini:
|
|
|
|
|
|
|
|
all: html gemini
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -r $(OUT_DIR)
|