Makefile (868B)
1 # CC0 license for source code 2 # 3 # Generates the source code 4 # simple script to convert markdown to html format 5 6 .PHONY: all build copy clean 7 8 OUT_DIR = output 9 FORMAT = -f markdown+link_attributes 10 TEMPLATE = template.html 11 RSYNC_OPTS = -avz 12 DEPLOY_PATH = # Add yours here 13 MD = $(shell find . -type f -name "*.md" -not -path "./$(OUT_DIR)/*") 14 HTML = $(patsubst ./%.md,$(OUT_DIR)/%.html,$(MD)) 15 16 all: build copy 17 18 build: 19 mkdir -p $(OUT_DIR) 20 for f in $(MD); do \ 21 out="$(OUT_DIR)/$${f#./}"; \ 22 out="$${out%.md}.html"; \ 23 mkdir -p "$$(dirname "$$out")"; \ 24 pandoc $(FORMAT) \ 25 --template=$(TEMPLATE) \ 26 "$$f" -o "$$out"; \ 27 done 28 29 copy: 30 rsync -a \ 31 --exclude=$(OUT_DIR) \ 32 --exclude=$(TEMPLATE) \ 33 --exclude=Makefile \ 34 --exclude=.git \ 35 --exclude="*.md" \ 36 ./ $(OUT_DIR)/ 37 38 deploy: 39 rsync $(RSYNC_OPTS) $(OUT_DIR)/* $(DEPLOY_PATH) 40 41 clean: 42 rm -rf $(OUT_DIR)