aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile61
1 files changed, 50 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 35b25ea..abf2739 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,54 @@
-OUTPUT=`pwd`/build
+PROJ_ROOT:=$(shell git rev-parse --show-toplevel)
+SCRIPTS_DIR:=$(PROJ_ROOT)/scripts
+STATIC_DIR:=static
+IMAGES_DIR:=$(STATIC_DIR)/media
+VIDEOS_DIR:=$(STATIC_DIR)/media/videos
+BUILD_DIR:=build
+blog_dir = $(shell $(SCRIPTS_DIR)/org-get-slug.sh $(1))
+POSTS_ORG_INPUT:=$(wildcard posts/*.org)
+POSTS_ORG_SUM_XML_OUTPUT:=$(patsubst posts/%.org, posts/%.sum.xml, $(POSTS_ORG_INPUT))
+POSTS_ORG_SUM_OUTPUT:=$(patsubst posts/%.org, posts/%.sum.html, $(POSTS_ORG_INPUT))
+POSTS_ORG_HTML_OUTPUT:=$(foreach post,$(POSTS_ORG_INPUT),$(BUILD_DIR)$(call blog_dir,$(post))/index.html)
+STATIC_FILES:=$(shell find $(STATIC_DIR) -type f)
+STATIC_FILES_OUT:=$(patsubst $(STATIC_DIR)/%,$(BUILD_DIR)/%,$(STATIC_FILES))
-all: build
+.PHONY: all
+all: $(BUILD_DIR)/index.html \
+ $(BUILD_DIR)/index.xml \
+ $(POSTS_ORG_HTML_OUTPUT) \
+ $(STATIC_FILES_OUT)
-.PHONY: build
-build:
- @hugo -d ${OUTPUT}
+posts/%.preview.org: posts/%.org
+ $(SCRIPTS_DIR)/generate_post_preview.sh $< > $@
-.PHONY: deploy
-deploy: build
- @rsync -avz ${OUTPUT}/ kennyballou.com:/srv/www/blog/.
+posts/%.sum.html: posts/%.org posts/%.preview.org
+ $(SCRIPTS_DIR)/generate_post_summary_html.sh $^ > $@
-.PHONY: serve
-serve:
- -hugo -d ${OUTPUT} serve
+posts/%.sum.xml: posts/%.org posts/%.preview.org
+ $(SCRIPTS_DIR)/generate_post_summary_xml.sh $^ > $@
+
+$(BUILD_DIR):
+ mkdir -p $@
+
+$(BUILD_DIR)/index.html: $(POSTS_ORG_SUM_OUTPUT) | $(BUILD_DIR)
+ $(SCRIPTS_DIR)/generate_index_html.sh $^ > $@
+
+$(BUILD_DIR)/index.xml: $(POSTS_ORG_SUM_XML_OUTPUT) | $(BUILD_DIR)
+ $(SCRIPTS_DIR)/generate_rss.sh $^ > $@
+
+define BLOG_BUILD_DEF
+$(BUILD_DIR)$(call blog_dir,$T):
+ mkdir -p $$@
+$(BUILD_DIR)$(call blog_dir,$T)/index.html: $T | $(BUILD_DIR)$(call blog_dir,$T)
+ $(SCRIPTS_DIR)/generate_post_html.sh $$< > $$@
+endef
+
+$(foreach T,$(POSTS_ORG_INPUT),$(eval $(BLOG_BUILD_DEF)))
+
+$(BUILD_DIR)/%: $(STATIC_DIR)/% | $(BUILD_DIR)
+ mkdir -p $(dir $@)
+ cp $< $@
+
+.PHONY: clean
+clean:
+ -rm -r $(BUILD_DIR)