-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
56 lines (46 loc) · 2.18 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
#########################################
# PUBLIC MACROS
#########################################
# represent sthe folder, relative to the projhect root directory, where to put the pdf and all the metadata generated by latex
BUILD_FOLDER:=build
# represents the software represenitng the latex compiler to use
LATEX_CC:=pdflatex
# the Latex root source code document that will be use as starting point of the latex build process
# The filename is relative to the project root directory
# No ".tex" extension is needed since it will be automatically appended (e.g., `main.tex` should be written as `main`)
MAIN_SRC:=main
# name of the output that will be generated inside BUILD_FOLDER. No extension is needed (e.g., `main.pdf` should be written as `main`)
OUTPUT_NAME:=main
# Additional latex flags that will be used in the build process. Note that -halt-on-error and -output-directory are automatically added
# to the build process
LATEX_FLAGS:=
#########################################
# PROTECTED MACROS
#########################################
# a semantic version string representing the versioning of the build process
# Follows a quick changelog:
# 1.0 first version
TEMPLATE_VERSION:=1.0
# Some additional regarding the alteration of the build process. Use this to convey to other people your build process customizations
NOTES:=
#########################################
# INTERNAL DETAILS
#########################################
DEFAULT:="\e[0m"
GREEN:="\e[32m"
.DEFAULT_GOAL:=all
.phony: show-info all clean
show-info:
@echo "Latex Template version is "$(TEMPLATE_VERSION)
@echo "Notes from the developer regarding some notoriuos change in this file: "
@echo $(NOTES)
all: show-info
@echo "Compiling first time..."
$(LATEX_CC) -halt-on-error -output-directory=$(BUILD_FOLDER) $(LATEX_FLAGS) $(MAIN_SRC).tex
@echo "Compiling second time..."
$(LATEX_CC) -halt-on-error -output-directory=$(BUILD_FOLDER) $(LATEX_FLAGS) $(MAIN_SRC).tex
if test "$(BUILD_FOLDER)/$(MAIN_SRC).pdf" != "$(BUILD_FOLDER)/$(OUTPUT_NAME).pdf"; then mv -v $(BUILD_FOLDER)/$(MAIN_SRC).pdf $(BUILD_FOLDER)/$(OUTPUT_NAME).pdf; fi
@echo $(GREEN)"DONE"$(DEFAULT)
clean:
rm -fv $(BUILD_FOLDER)/*
@echo $(GREEN)"DONE"$(DEFAULT)