100 lines
3.2 KiB
Makefile
100 lines
3.2 KiB
Makefile
## 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
|
|
|
|
|
|
|
|
###############################################################################
|
|
## Internal setup (do not change)
|
|
###############################################################################
|
|
|
|
|
|
## Auxiliary files
|
|
## (Do not change!)
|
|
TITLEPAGE = titlepage.tex
|
|
FRONTMATTER = frontmatter.tex
|
|
BACKMATTER = backmatter.tex
|
|
|
|
TMP1 = Assets/$(TITLEPAGE:%.tex=__%.filled.tex)
|
|
TMP2 = Assets/$(FRONTMATTER:%.tex=__%.filled.tex)
|
|
TMP3 = Assets/$(BACKMATTER:%.tex=__%.filled.tex)
|
|
TMP = $(TMP1) $(TMP2) $(TMP3)
|
|
|
|
|
|
## 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
|
|
OPTIONS += --include-in-header=$(TMP1)
|
|
OPTIONS += --include-before-body=$(TMP2)
|
|
OPTIONS += --include-after-body=$(TMP3)
|
|
|
|
|
|
## 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
|
|
clean:
|
|
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
|
|
${TARGET}: $(SRC) $(REFERENCES) $(META) $(BIBFILE) $(TMP)
|
|
$(PANDOC) ${OPTIONS} -o $@ $(SRC) $(REFERENCES)
|
|
|
|
|
|
## Build auxiliary files (title page, backmater, references)
|
|
$(TMP): Assets/__%.filled.tex: Assets/%.tex $(META)
|
|
$(PANDOC) $(AUX_OPTS) --template=$< --metadata-file=$(META) -o $@ $<
|
|
|
|
|
|
###############################################################################
|
|
## Declaration of phony targets
|
|
###############################################################################
|
|
|
|
|
|
.PHONY: cleanthesis clean distclean
|