63 lines
1.7 KiB
Makefile
63 lines
1.7 KiB
Makefile
SRC_DIR = src
|
|
IMG_DIR = img
|
|
OUT_DIR = site
|
|
|
|
ROOT_DIR = $(SRC_DIR)/root
|
|
|
|
BLOG_BASE_DIR = blog/
|
|
BLOG_BUILD_DIR = $(BLOG_BASE_DIR)out/html/
|
|
BLOG_OUT_DIR = $(OUT_DIR)/blog
|
|
BLOG_INDEX = $(BLOG_BUILD_DIR)/index.html
|
|
|
|
VN = src/vn/
|
|
|
|
PAGES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.html")
|
|
STYLES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.css")
|
|
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)
|
|
CSS_TARGETS = $(STYLES:$(ROOT_DIR)/%.css=$(OUT_DIR)/%.css)
|
|
PNG_TARGETS = $(IMG_DIR)/%.png=$(OUT_DIR)/%.png
|
|
|
|
all: html blog vn | $(OUT_DIR)
|
|
|
|
vn: $(VN) | $(OUT_DIR)
|
|
cp -r $(VN) $(OUT_DIR)/vn
|
|
|
|
html: $(HTML_TARGETS) $(CSS_TARGETS) | $(OUT_DIR)
|
|
cp $(IMG_DIR)/*.ico $(OUT_DIR)/
|
|
cp $(IMG_DIR)/*.png $(OUT_DIR)/
|
|
cp $(IMG_DIR)/*.jpg $(OUT_DIR)/
|
|
|
|
$(OUT_DIR)/%.html: $(ROOT_DIR)/%.html $(HTML_INCLUDES) $(BLOG_INDEX) | $(OUT_DIR)
|
|
python ppp.py $< $(HTML_INCLUDES) $(BLOG_INDEX) > $@
|
|
|
|
$(OUT_DIR)/%.css: $(ROOT_DIR)/%.css | $(OUT_DIR)
|
|
cp $< $@
|
|
|
|
$(OUT_DIR):
|
|
mkdir -p $@
|
|
|
|
$(BLOG_INDEX):
|
|
mkdir -p $(BLOG_OUT_DIR)
|
|
make --directory $(BLOG_BASE_DIR) html
|
|
|
|
# make blog from submodule and apply site templating
|
|
blog: $(HTML_INCLUDES) $(CSS_TARGETS)
|
|
mkdir -p $(BLOG_OUT_DIR)
|
|
make --directory $(BLOG_BASE_DIR) html
|
|
cp -r $(BLOG_BUILD_DIR)/* $(BLOG_OUT_DIR)
|
|
for page in `find "$(BLOG_OUT_DIR)" -wholename "*.html"`; do \
|
|
python ppp.py $$page $(HTML_INCLUDES) > temp ; \
|
|
mv temp $$page ; \
|
|
cp $(CSS_TARGETS) $(IMG_DIR)/*.ico `dirname $$page` ; \
|
|
done
|
|
|
|
clean:
|
|
make --directory $(BLOG_BASE_DIR) clean
|
|
rm -rf $(OUT_DIR)
|
|
|
|
.PHONY: blog vn
|