-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
95 lines (73 loc) · 2.58 KB
/
makefile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
### Latex.Make
# Author: Jason Hiebel
# This version of this file was taken from the repo found at
# http://github.com/jrsmith3/latex_template
# This is a simple makefile for compiling LaTeX documents.
# Targets:
# default : compiles the document in to three formats (DVI -> PS -> PDF)
# display : displays the compiled document in a common PDF viewer.
# (Linux = Evince, OSX = OS Set Default)
# clean : removes the obj/ directory holding temporary files
# Set PROJECT to the name of the .tex file to build.
PROJECT = CV_martinberoiz
figuresdir = figures
scriptsdir = scripts
all: obj/$(PROJECT).pdf display
default: obj/$(PROJECT).pdf
display: default
${PDFVIEWER} obj/$(PROJECT).pdf
install:
cp obj/$(PROJECT).pdf .
lpr: default
lpr obj/$(PROJECT).pdf &
wc: default
@ echo "Word count:"
@ pdftotext obj/$(PROJECT).pdf - | wc -w
@ echo "\r"
### Compilation Flags
LATEX_FLAGS = -shell-escape -halt-on-error -quiet -output-directory obj
TEXMFOUTPUT = obj/
### File Types (for dependancies)
TEX_FILES = $(shell find . -name '*.tex')
BIB_FILES = $(shell find . -name '*.bib')
STY_FILES = $(shell find . -name '*.sty')
CLS_FILES = $(shell find . -name '*.cls')
BST_FILES = $(shell find . -name '*.bst')
EPS_FILES = $(shell find . -name '*.eps')
### Standard PDF Viewers
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
PDFVIEWER = xdg-open
endif
ifeq ($(UNAME), Darwin)
PDFVIEWER = open
endif
### Clean
# This target cleans the temporary files generated by the tex programs in
# use. All temporary files generated by this makefile will be placed in obj/
# so cleanup is easy.
clean:
rm -rf obj/*
### Core Latex Generation
# Performs the typical build process for latex generations so that all
# references are resolved correctly. If adding components to this run-time
# always take caution and implement the worst case set of commands.
# Example: latex, bibtex, latex, latex
#
# Note the use of order-only prerequisites (prerequisites following the |).
# Order-only prerequisites do not affect the target -- if the order-only
# prerequisite has changed and none of the normal prerequisites have changed
# then this target IS NOT run.
obj/:
mkdir -p obj/
obj/$(PROJECT).aux: $(TEX_FILES) $(STY_FILES) $(CLS_FILES) $(EPS_FILES) | obj/
pdflatex $(LATEX_FLAGS) $(PROJECT)
obj/$(PROJECT).bbl: $(BIB_FILES) $(BST_FILES) | obj/$(PROJECT).aux
ifneq ($(BIB_FILES),)
cp $(BIB_FILES) $(STY_FILES) $(BST_FILES) obj
#cp *.bib obj
( cd obj && bibtex $(PROJECT) )
pdflatex $(LATEX_FLAGS) $(PROJECT)
endif
obj/$(PROJECT).pdf: obj/$(PROJECT).aux obj/$(PROJECT).bbl
pdflatex $(LATEX_FLAGS) $(PROJECT)