aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: b005f683f5c7cc387736bdd2023041a00a13279a (plain)
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
34
35
36
37
38
39
40
41
42
## Requisite directories
BUILD_DIR ?= build
SH ?= bash
$(BUILD_DIR)/stories $(BUILD_DIR):
	mkdir -p $@


## MD Files -> HTML
MARKDOWNFILES := $(wildcard md/*.md)
HTMLTARGETS := $(patsubst md/%.md, $(BUILD_DIR)/stories/%.html, $(MARKDOWNFILES))

$(BUILD_DIR)/stories/%.html:: md/%.md | $(BUILD_DIR)/stories
	pandoc "$<" \
		--standalone \
		--embed-resources \
		--toc \
		--template template.html \
		-o "$@"


## Shell Script -> MD Files -> HTML
GENFILES := $(wildcard gen/gen_*.sh)
GENTARGETS := $(patsubst gen/gen_%.sh, $(BUILD_DIR)/%.html, $(GENFILES))

$(BUILD_DIR)/%.html:: gen/gen_%.sh | $(BUILD_DIR)
	$(SH) $< | pandoc \
		--standalone \
		--embed-resources \
		--template template.html \
		-o "$@"

all: $(HTMLTARGETS) $(GENTARGETS)
.PHONY: all
.DEFAULT_GOAL := all

deploy: all
	rsync -auv $(BUILD_DIR)/ root@ganymede:/var/www/papa_stories
.PHONY: deploy

clean:
	rm -rf $(BUILD_DIR)
.PHONY: clean