Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (50 sloc) 1.79 KB
# makefile options
# make (default): build pdf
# make clean: cleanup temporary latex files
# make latexclean: remove latex files and auxiliary directories
# make distclean: use git's clean command to get rid of ALL files
# make show: use xdg-open to open pdf file
# make nb: start the IPython Notebook server
# make all: unconditionally build all (default) targets
# make dist: build the pdf distribution: copy pdf to a filename with date and $REVISION
# (if it doesn't resolve the problem, do a healthy make distclean; make)
PARTS_PAT =?-?-*
IPYTHON ?= jupyter
PARTS := $(filter-out $(MASTER).ipynb 0-0-index.ipynb, $(wildcard *.ipynb))
PARTS_TEX := $(patsubst %.ipynb,%.tex,$(PARTS))
REVISION := $(shell git rev-parse --short HEAD)
TIMESTAMP := $(shell date +"%Y%m%d")
JOB := python4mathematiker
# $(info $(PARTS))
.PHONY = clean latexclean distclean build show cont upload
$(MAKE) -j 4 pdf
latexmk -c
find . -name '*.synctex.gz' -delete
# convert all partial tex files
%.tex: %.ipynb res/partial.tplx
$(IPYTHON) nbconvert --template res/partial.tplx --to latex $<
# convert the (empty) master file
$(JOB).pdf: master.ipynb $(PARTS_TEX) res/master.tplx
$(IPYTHON) nbconvert --template res/master.tplx --to latex $(MASTER).ipynb
latexmk -pdf -jobname="$(JOB)" -pdflatex="pdflatex --shell-escape %O %S" $(MASTER).tex
pdf: $(JOB).pdf
latexmk -C
find -type d -name "$(PARTS_PAT)" | xargs rm -rf
-${RM} -f *.tex
-git clean -fdX .
-${RM} -f *.tex
show: build
xdg-open $(JOB).pdf
$(IPYTHON) notebook --no-browser
make -B
dist: build
cp $(JOB).pdf $(JOB)-${TIMESTAMP}-${REVISION}.pdf
upload: build
scp $(JOB).pdf