ktyl.dev/makefile

63 lines
1.7 KiB
Makefile
Raw Permalink Normal View History

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_OUT_DIR = $(OUT_DIR)/blog
2023-03-13 23:27:18 +01:00
BLOG_INDEX = $(BLOG_BUILD_DIR)/index.html
2024-01-06 01:57:08 +01:00
VN = src/vn/
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")
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)
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
2024-01-06 01:57:08 +01:00
all: html blog vn | $(OUT_DIR)
vn: $(VN) | $(OUT_DIR)
cp -r $(VN) $(OUT_DIR)/vn
2022-12-24 19:38:21 +01:00
html: $(HTML_TARGETS) $(CSS_TARGETS) | $(OUT_DIR)
2024-06-08 12:59:23 +02:00
cp $(IMG_DIR)/*.ico $(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
2023-03-13 23:27:18 +01:00
$(OUT_DIR)/%.html: $(ROOT_DIR)/%.html $(HTML_INCLUDES) $(BLOG_INDEX) | $(OUT_DIR)
2024-06-08 17:15:02 +02:00
python ppp.py $< $(HTML_INCLUDES) $(BLOG_INDEX) > $@
2021-09-13 01:06:53 +02:00
2024-06-16 17:08:22 +02:00
$(OUT_DIR)/%.css: $(ROOT_DIR)/%.css | $(OUT_DIR)
cp $< $@
$(OUT_DIR):
mkdir -p $@
2023-03-13 23:27:18 +01:00
$(BLOG_INDEX):
mkdir -p $(BLOG_OUT_DIR)
2023-03-11 13:20:04 +01:00
make --directory $(BLOG_BASE_DIR) html
2023-03-13 23:27:18 +01:00
# make blog from submodule and apply site templating
blog: $(HTML_INCLUDES) $(CSS_TARGETS)
mkdir -p $(BLOG_OUT_DIR)
2023-03-11 14:35:00 +01:00
make --directory $(BLOG_BASE_DIR) html
2023-03-13 23:27:18 +01:00
cp -r $(BLOG_BUILD_DIR)/* $(BLOG_OUT_DIR)
for page in `find "$(BLOG_OUT_DIR)" -wholename "*.html"`; do \
2024-06-08 17:15:02 +02:00
python ppp.py $$page $(HTML_INCLUDES) > temp ; \
2023-03-13 23:27:18 +01:00
mv temp $$page ; \
2024-06-08 12:59:23 +02:00
cp $(CSS_TARGETS) $(IMG_DIR)/*.ico `dirname $$page` ; \
2023-03-13 23:27:18 +01:00
done
clean:
2023-08-10 23:02:03 +02:00
make --directory $(BLOG_BASE_DIR) clean
2023-03-13 23:27:18 +01:00
rm -rf $(OUT_DIR)
2024-01-06 01:57:08 +01:00
.PHONY: blog vn