version 1.4 rather than bugfix release.
[ShaarliOS.git] / Makefile
blobf2ab20b29fb166c694bc09741a5e4e0e144b0a90
1 #!/usr/bin/make
3 # Prerequisites:
5 # Mandatory:
7 # kramdown: http://kramdown.rubyforge.org/
8 # $ sudo gem install kramdown
10 # Optional:
12 # graphviz: http://www.graphviz.org/
13 # http://www.graphviz.org/Download_macos.php
14 # or $ sudo port install graphviz +no_x11
15 # pdflatex: https://www.tug.org/texlive/
16 # follow https://code.google.com/p/mactlmgr/
18 # some commands:
19 RM=rm
20 DOT=dot
21 KRAMDOWN=kramdown
22 PDFLATEX=pdflatex
24 BUILD_DST := build
26 # graphviz
27 $(BUILD_DST)/%.png: %.dot
28 $(DOT) -Tpng -o $@ $<
29 $(BUILD_DST)/%.pdf: %.dot
30 $(DOT) -Tpdf -o $@ $<
31 $(BUILD_DST)/%.svg: %.dot
32 $(DOT) -Tsvg -o $@ $<
33 $(BUILD_DST)/%.svg: %.svg
34 cp $< $@
36 # markdown / kramdown
37 $(BUILD_DST)/%.html: %.md
38 -$(KRAMDOWN) --template templates/document-mathjax $< > $@
39 $(BUILD_DST)/%.tex: %.md
40 -$(KRAMDOWN) --template templates/document-toc --output latex $< > $@
41 %.pdf: %.tex
42 # needs texlive package ucs
43 # call 2x to get toc right
44 -$(PDFLATEX) -output-directory=$(BUILD_DST) $< ; $(PDFLATEX) -output-directory=$(BUILD_DST) $<
46 .PHONY: clean
48 SPECS_DOT := $(patsubst %.dot,$(BUILD_DST)/%.pdf,$(wildcard **.dot))
49 SPECS_HTML := $(patsubst %.md,$(BUILD_DST)/%.html,$(wildcard **.md))
50 SPECS_SVG := $(patsubst %.svg,$(BUILD_DST)/%.svg,$(wildcard **.svg))
51 SPECS_TEX := $(patsubst %.md,$(BUILD_DST)/%.pdf,$(wildcard **.md))
53 TARGETS := $(SPECS_HTML) $(SPECS_DOT) $(SPECS_SVG)
55 all: $(TARGETS)
57 pdf: $(SPECS_TEX) $(SPECS_DOT)
59 clean:
60 -$(RM) $(TARGETS) $(SPECS_TEX) *.aux *.log *.out *.toc