-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.base
37 lines (27 loc) · 1.03 KB
/
Makefile.base
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
PDF_DIR=target
#-output-directory $(PDF_DIR)
LATEX=pdflatex
LATEX_ARGS=--interaction=nonstopmode -shell-escape -file-line-error -file-line-error
SRCS = $(wildcard *.tex)
PDFS = $(patsubst %.tex,%.pdf,$(SRCS))
#JUNK = *.toc *.aux *.pdf *.ps *.eps *.log *.lof *.bbl *.blg *.dvi *.log *.out *.tmp
#JUNK_PARAMS = $(foreach mask,$(JUNK),-name "$(mask)" -or )
.PHONY: all clean pdf
all: pdf $(PDFS)
pdf: $(PDFS)
%.pdf: %.tex
@echo ""
@echo "== Compiling $*..."
@echo ""
mkdir -p $(PDF_DIR)
echo $$SHELL
echo $(shell pwd)
[ ! -e $(PDF_DIR)/media ] && ln -s $(shell pwd)/media/ $(PDF_DIR)/media || true
[ ! -e $(PDF_DIR)/$*.tex ] && ln -s $(shell pwd)/$*.tex $(PDF_DIR)/$*.tex || true
cd $(PDF_DIR) && $(LATEX) $(LATEX_ARGS) $*
cd $(PDF_DIR) && $(LATEX) $(LATEX_ARGS) $*
# https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$*.pdf $(PDF_DIR)/$*.pdf
clean:
rm -rf $(PDF_DIR)
rm -f *.pdf