-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
53 lines (39 loc) · 1.29 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Makefile
BUILD_FOLDER=$(CURDIR)/bld
PAPER=src/paper.md
OUTPUT=Debugging_What_you_should_know
SVGS=$(wildcard src/img/*.svg)
IMAGES=$(SVGS:.svg=.pdf)
all: pdf
full: init clean directories pdf
directories:
@mkdir -p $(BUILD_FOLDER)
pdf: $(IMAGES) $(PAPER)
@echo "Generating doc $(OUTPUT)"
@pandoc -S -o bld/$(OUTPUT).pdf --filter pandoc-citeproc $(PAPER)
docx: $(IMAGES) $(PAPER)
@echo "Generating doc $(OUTPUT)"
@pandoc -S -o bld/$(OUTPUT).docx --filter pandoc-citeproc $(PAPER)
%.pdf: %.svg
@echo "Converting $< to $(subst src/img/,,$@)"
@convert -density 343 $< bld/$(subst src/img/,,$@)
init:
@command -v pandoc > /dev/null 2>&1 || (echo 'pandoc not found http://johnmacfarlane.net/pandoc/installing.html' && exit 1)
@command -v pandoc-citeproc > /dev/null 2>&1 || (echo 'pandoc-citeproc not found http://johnmacfarlane.net/pandoc/installing.html' && exit 1)
@command -v convert > /dev/null 2>&1 || (echo 'ImageMagick required for converting images' && exit 1)
clean:
@echo "Cleaning build folder: $(BUILD_FOLDER)"
@rm -rf $(BUILD_FOLDER)/*
OS = $(shell uname -s)
ifeq ($(strip $(OS)),Linux)
PDF_VIEW = xdg-open
else
ifeq "CYGWIN" "$(findstring CYGWIN,$(OS))"
PDF_VIEW = cygstart
else
PDF_VIEW = open
endif
endif
view: pdf
$(shell $(PDF_VIEW) bld/$(OUTPUT).pdf &)
.PHONY: init clean