2016-01-07 21:25:17 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Variables
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
export MAKE_FLAGS=--no-print-directory
|
|
|
|
|
|
|
|
export OUT=$(shell pwd)/bin
|
|
|
|
export OUT_PDF=$(OUT)/pdf/
|
|
|
|
export OUT_HTML=$(OUT)/html/
|
2016-07-03 17:06:18 +00:00
|
|
|
export OUT_MAN=$(OUT)/man/
|
2016-01-07 21:25:17 +00:00
|
|
|
|
|
|
|
DOCUMENT_CLASS=article
|
|
|
|
SETTING_FONTSIZE=11pt
|
|
|
|
|
|
|
|
## Source directory
|
|
|
|
SRC_DIR=$(shell pwd)/src
|
|
|
|
|
2016-01-11 17:00:56 +00:00
|
|
|
## Templates
|
|
|
|
TEMPLATES=$(shell pwd)/templates
|
|
|
|
|
2016-01-07 21:25:17 +00:00
|
|
|
## CSS directory
|
2016-01-11 17:00:56 +00:00
|
|
|
CSS_DIR=$(TEMPLATES)/css
|
|
|
|
CSS_SRC=$(shell find $(CSS_DIR) -type f -name "*.css")
|
|
|
|
CSS_INCLUDES=$(foreach x, $(CSS_SRC), --variable css=$(x))
|
2016-01-07 21:25:17 +00:00
|
|
|
|
|
|
|
## All markdown files in the working directory
|
|
|
|
export SRC=$(shell find $(SRC_DIR) -name "*.md" | sort)
|
|
|
|
|
|
|
|
DOCUMENT_SETTINGS_PDF= \
|
|
|
|
--listings \
|
|
|
|
--variable fontsize=$(SETTING_FONTSIZE) \
|
|
|
|
--variable papersize=a4paper \
|
|
|
|
--variable classoption=cleardoublepage=empty \
|
|
|
|
--variable classoption=index=totoc \
|
|
|
|
--variable classoption=openright \
|
|
|
|
--variable classoption=final \
|
|
|
|
--variable classoption=listof=nochaptergap \
|
|
|
|
--variable documentclass=$(DOCUMENT_CLASS) \
|
|
|
|
--variable babel-lang=english \
|
|
|
|
--variable geometry=portrait
|
|
|
|
|
|
|
|
DOCUMENT_SETTINGS_HTML= \
|
2016-01-11 17:00:56 +00:00
|
|
|
$(CSS_INCLUDES) \
|
2016-01-07 21:25:17 +00:00
|
|
|
--variable lang=de \
|
|
|
|
--variable lof=true \
|
|
|
|
--variable lol=true \
|
|
|
|
--variable lot=true \
|
|
|
|
--variable toc=true \
|
|
|
|
--table-of-contents \
|
|
|
|
--webtex
|
|
|
|
|
2016-07-03 17:09:20 +00:00
|
|
|
DOCUMENT_SETTINGS_MAN= \
|
2016-07-03 17:12:51 +00:00
|
|
|
-s \
|
2016-07-03 17:09:20 +00:00
|
|
|
--variable section=5 \
|
|
|
|
|
2016-01-07 21:25:17 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Binary and argument construction
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
ECHO_CMD=$(shell which echo)
|
|
|
|
ECHO_ARG=-e
|
|
|
|
ECHO=$(ECHO_CMD) $(ECHO_ARG)
|
|
|
|
export ECHO
|
|
|
|
|
|
|
|
MKDIR_CMD=$(shell which mkdir)
|
|
|
|
MKDIR_ARG=-p
|
|
|
|
MKDIR=$(MKDIR_CMD) $(MKDIR_ARG)
|
|
|
|
export MKDIR
|
|
|
|
|
|
|
|
RM_CMD=$(shell which rm)
|
|
|
|
RM_ARG=-fr
|
|
|
|
RM=$(RM_CMD) $(RM_ARG)
|
|
|
|
export RM
|
|
|
|
|
|
|
|
PANDOC=$(shell which pandoc)
|
|
|
|
|
2016-01-08 10:44:37 +00:00
|
|
|
PANDOC_PARAMS=-r markdown+simple_tables+table_captions+yaml_metadata_block+definition_lists+raw_html+markdown_in_html_blocks \
|
|
|
|
--filter pandoc-crossref
|
2016-01-07 21:25:17 +00:00
|
|
|
|
|
|
|
PANDOC_CC=$(PANDOC) $(PANDOC_PARAMS)
|
|
|
|
|
|
|
|
export PANDOC_CC_PDF=$(PANDOC) \
|
|
|
|
$(PANDOC_PARAMS) \
|
|
|
|
--latex-engine=pdflatex \
|
|
|
|
$(DOCUMENT_SETTINGS_PDF)
|
|
|
|
|
|
|
|
export PANDOC_CC_HTML=$(PANDOC) $(PANDOC_PARAMS) $(DOCUMENT_SETTINGS_HTML)
|
|
|
|
|
2016-07-03 17:12:51 +00:00
|
|
|
export PANDOC_CC_MAN=$(PANDOC) $(PANDOC_PARAMS) $(DOCUMENT_SETTINGS_MAN)
|
|
|
|
|
2016-01-07 21:25:17 +00:00
|
|
|
TARGET_PDF=$(OUT_PDF)/paper.pdf
|
|
|
|
TARGET_HTML=$(OUT_HTML)/index.html
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Tasks
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
# Main task
|
|
|
|
all: $(TARGET_PDF) $(TARGET_HTML)
|
|
|
|
@$(ECHO) "\t[ALL ]"
|
|
|
|
|
|
|
|
# create out directory
|
|
|
|
$(OUT):
|
|
|
|
@$(ECHO) "\t[MKDIR ] $@"
|
|
|
|
@$(MKDIR) $(OUT)
|
|
|
|
|
|
|
|
# create html out directory
|
|
|
|
$(OUT_HTML): $(OUT)
|
|
|
|
@$(ECHO) "\t[MKDIR ] $@"
|
|
|
|
@$(MKDIR) $(OUT_HTML)
|
|
|
|
|
|
|
|
# create html out directory
|
|
|
|
$(OUT_PDF): $(OUT)
|
|
|
|
@$(ECHO) "\t[MKDIR ] $@"
|
|
|
|
@$(MKDIR) $(OUT_PDF)
|
|
|
|
|
|
|
|
# cleanup task
|
|
|
|
clean:
|
|
|
|
@$(ECHO) "\t[RM ] $@"
|
|
|
|
@$(RM) $(OUT)
|
|
|
|
|
2016-01-08 11:01:22 +00:00
|
|
|
pdf: $(TARGET_PDF)
|
|
|
|
|
2016-01-07 21:25:17 +00:00
|
|
|
$(TARGET_PDF): $(OUT_PDF)
|
|
|
|
@$(ECHO) "\t[PANDOC] pdf"
|
|
|
|
@$(PANDOC_CC_PDF) \
|
|
|
|
--template $(TEMPLATES)/default.latex \
|
|
|
|
$(SRC) -o $@
|
|
|
|
|
2016-01-08 11:01:22 +00:00
|
|
|
html: $(TARGET_HTML)
|
2016-01-07 21:25:17 +00:00
|
|
|
|
|
|
|
$(TARGET_HTML): $(OUT_HTML)
|
|
|
|
@$(ECHO) "\t[PANDOC] html"
|
|
|
|
@$(PANDOC_CC_HTML) \
|
|
|
|
--template $(TEMPLATES)/default.html5 \
|
|
|
|
$(SRC) -o $@
|
|
|
|
|
|
|
|
.PHONY: $(TARGET_PDF) $(TARGET_HTML)
|
|
|
|
|