2019-10-18 16:01:19 +02:00
|
|
|
## Source files
|
|
|
|
## (Adjust to your needs. Order of markdown files in $(SRC) matters!)
|
|
|
|
PANDOC = pandoc
|
|
|
|
DOC = Docs
|
|
|
|
META = Assets/metadata.yaml
|
|
|
|
SRC = $(DOC)/Project.md
|
|
|
|
BIBFILE = Assets/Citations.bib
|
|
|
|
TARGET = $(DOC)/Project.pdf
|
2019-09-30 20:05:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-18 16:01:19 +02:00
|
|
|
###############################################################################
|
|
|
|
## Internal setup (do not change)
|
|
|
|
###############################################################################
|
2019-09-30 20:05:34 +02:00
|
|
|
|
2019-10-18 16:01:19 +02:00
|
|
|
|
|
|
|
## Auxiliary files
|
|
|
|
## (Do not change!)
|
|
|
|
TITLEPAGE = titlepage.tex
|
2019-10-18 16:30:04 +02:00
|
|
|
TMP = Assets/$(TITLEPAGE:%.tex=__%.filled.tex)
|
2019-10-18 16:01:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Pandoc options
|
|
|
|
AUX_OPTS =
|
|
|
|
|
|
|
|
OPTIONS = -f markdown
|
|
|
|
OPTIONS += --pdf-engine=pdflatex
|
|
|
|
OPTIONS += --filter=pandoc-citeproc
|
|
|
|
OPTIONS += --metadata-file=$(META)
|
|
|
|
OPTIONS += -M bibliography=$(BIBFILE)
|
|
|
|
OPTIONS += --listings
|
2019-10-18 16:30:04 +02:00
|
|
|
OPTIONS += --include-in-header=$(TMP)
|
2019-10-18 16:01:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Template variables
|
|
|
|
TEMPLATE_DL_DIR = .tmp_template_dl
|
|
|
|
|
|
|
|
CLEANTHESIS_TEMPLATE = Assets/cleanthesis.sty
|
|
|
|
|
|
|
|
TEMPLATE_FILES = $(CLEANTHESIS_TEMPLATE)
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
## Main targets (do not change)
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
$(SRC): $(DOC)/Project.org
|
|
|
|
$(PANDOC) -o $@ $<
|
|
|
|
|
|
|
|
## Use Clean Thesis template (https://github.com/derric/cleanthesis)
|
|
|
|
cleanthesis: TEMPLATE_FILE += $(CLEANTHESIS_TEMPLATE)
|
|
|
|
cleanthesis: TEMPLATE_REPO += $(CLEANTHESIS_REPO)
|
|
|
|
cleanthesis: TEMPLATE_VERSION += $(CLEANTHESIS_VERSION)
|
|
|
|
cleanthesis: AUX_OPTS += -M cleanthesis=true -M cleanthesisbibfile=$(BIBFILE:%.bib=%)
|
|
|
|
cleanthesis: OPTIONS += --include-in-header=Assets/include-header.tex $(AUX_OPTS)
|
|
|
|
cleanthesis: $(CLEANTHESIS_TEMPLATE) $(TARGET)
|
|
|
|
|
|
|
|
|
|
|
|
## Clean-up: Remove temporary (generated) files and download folder
|
2019-09-30 20:05:34 +02:00
|
|
|
clean:
|
2019-10-18 16:01:19 +02:00
|
|
|
rm -rf $(TMP) $(TEMPLATE_DL_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
## Clean-up: Remove also genereated thesis and template files
|
|
|
|
distclean: clean
|
|
|
|
rm -f $(TARGET)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
## Auxiliary targets (do not change)
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
|
|
## Download template files
|
|
|
|
|
|
|
|
## Build thesis
|
2019-10-18 16:30:04 +02:00
|
|
|
${TARGET}: $(SRC) $(META) $(BIBFILE) $(TMP)
|
|
|
|
$(PANDOC) ${OPTIONS} -o $@ $(SRC)
|
2019-10-18 16:01:19 +02:00
|
|
|
|
|
|
|
|
2019-10-18 16:30:04 +02:00
|
|
|
## Build auxiliary files (title page, references)
|
2019-10-18 16:01:19 +02:00
|
|
|
$(TMP): Assets/__%.filled.tex: Assets/%.tex $(META)
|
|
|
|
$(PANDOC) $(AUX_OPTS) --template=$< --metadata-file=$(META) -o $@ $<
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
## Declaration of phony targets
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: cleanthesis clean distclean
|