-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (27 loc) · 958 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
PWD=$(shell pwd)
EDITOR=$(shell which vi)
PYTHON=$(shell which python3)
POSTS=$(shell find $(POSTS_DIR) -type f -name '*')
PYTHON_FLAGS=-B
SRC_DIR=src/
POSTS_DIR=posts/
TEMPLATE_DIR=templates/
TEST_DIR=test/
INDEX=index.html
FEED=feed.rss
MODULES=$(PWD)/$(SRC_DIR)
COMPILER=$(SRC_DIR)/build.py
XML_TEMPLATES=$(shell find $(TEMPLATE_DIR) -type f -name '*.xml')
HTML_TEMPLATES=$(shell find $(TEMPLATE_DIR) -type f -name '*.html')
PYTHON_TEST_FLAGS=-m unittest discover -p '*_test.py' -s $(TEST_DIR)
all: $(INDEX) $(FEED)
$(INDEX): $(COMPILER) $(HTML_TEMPLATES) $(POSTS)
$(PYTHON) $(PYTHON_FLAGS) $(COMPILER) blog $(POSTS_DIR) $(TEMPLATE_DIR) > $(INDEX)
$(FEED): $(COMPILER) $(XML_TEMPLATES) $(POSTS)
$(PYTHON) $(PYTHON_FLAGS) $(COMPILER) feed $(POSTS_DIR) $(TEMPLATE_DIR) > $(FEED)
post:
$(EDITOR) $(POSTS_DIR)/draft-`date +%Y-%m-%d`-title.txt
test: export PYTHONPATH=$(MODULES)
test:
$(PYTHON) $(PYTHON_FLAGS) $(PYTHON_TEST_FLAGS)
.PHONY: post test