Makefile 1.47 KB
Newer Older
PoroCYon's avatar
PoroCYon committed
1 2 3 4 5 6 7 8 9
# Copyright © 2017 PoroCYon
# This work is free. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it
# under the terms of the Do What The Fuck You Want To Public License,
# Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for
# more details.

default: all

PoroCYon's avatar
PoroCYon committed
10 11 12 13
DATE="$(shell date "+%B%e, %Y")"

MAINTITLE="lo kibystu pe la poros"

PoroCYon's avatar
PoroCYon committed
14 15 16
MATHJAX=https://github.com/mathjax/MathJax/raw/master/MathJax.js
PANDOC ?= pandoc
PDMARKDOWN="markdown_github+raw_tex+yaml_metadata_block+table_captions+implicit_figures+simple_tables+multiline_tables+grid_tables+tex_math_dollars+fenced_code_attributes+inline_code_attributes+markdown_attribute+fancy_lists+all_symbols_escapable+superscript+subscript+header_attributes-emoji"
PoroCYon's avatar
PoroCYon committed
17 18
PDFLAGS=-s --ascii -S -M date=$(DATE) \
    -V maintitle=$(MAINTITLE) -c /stc/style.css --mathjax=/stc/mathjax.js \
PoroCYon's avatar
PoroCYon committed
19 20
    --template=tpl/template -H tpl/header.html -B tpl/before.html -A tpl/after.html

PoroCYon's avatar
PoroCYon committed
21 22 23
INPUT_FILES=$(shell find src/ -type f -name "*.md")
OUTPUT_FILES=$(patsubst src/%.md, out/%.html, $(INPUT_FILES))

PoroCYon's avatar
PoroCYon committed
24 25 26 27 28 29 30 31 32 33 34 35
newmathjax:
	wget "$(MATHJAX)" -O stc/mathjax.js

%:
	mkdir -p "$@"

out/%.html: src/%.md
	$(PANDOC) $(PDFLAGS) -f $(PDMARKDOWN) -t html "$<" -o "$@"

stc/mathjax.js:
	wget "$(MATHJAX)" -O "$@"

PoroCYon's avatar
PoroCYon committed
36
all: out/ $(wildcard stc/*) stc/mathjax.js $(wildcard tpl/*.html) $(OUTPUT_FILES)
PoroCYon's avatar
PoroCYon committed
37
	@cp -vr stc/ out/
PoroCYon's avatar
PoroCYon committed
38 39 40 41 42 43 44 45

clean:
	@rm -rvf out/
distclean: clean
	@rm -v stc/mathjax.js

.PHONY: default all clean distclean newmathjax