summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorRomain Porte <microjoe@microjoe.org>2018-05-08 12:14:14 +0200
committerRomain Porte <microjoe@microjoe.org>2018-05-21 18:13:51 +0200
commit466801dab680a4491b48854069679f15f7a91b21 (patch)
tree272d8f9b29870c08c3be3336177e872294b0dd0f /Makefile
parent1e1d9ab154d06deb1231a15db27f3b8ea3576a03 (diff)
downloadlatex-makefile-466801dab680a4491b48854069679f15f7a91b21.tar.gz
latex-makefile-466801dab680a4491b48854069679f15f7a91b21.zip
Simpler version of Makefile
Instead of using a big .gitignore and a big clean target, we can tell latexmk to build into a dedicated directory. This way, all temporary files are located in a repository that we just have to ignore and remove. This allows us to have the .tex sources right next to the Makefile, which makes it easier to reason about instead of having to use the src/ subdirectory. Also moved README to reStructuredText (because Markdown sucks IMO) and removed gif and fancy badges in the README.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 12 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index 1115809..f2dba4f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# LaTeX basic Makefile
+# LaTeX Makefile
#
# WTFPL, 2016 - 2018 Romain Porte (MicroJoe) <microjoe@microjoe.org>
#
@@ -8,47 +8,30 @@
# Very important variables to set up
PDF=main.pdf
-PRINC=src/main.tex
+PRINC=main.tex
+AUXDIR=build
+LATEXMK=source ~/.bashrc && latexmk \
+ -auxdir=$(AUXDIR) \
+ -outdir=$(AUXDIR) \
+ -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make
# You want latexmk to *always* run, because make does not have all the info.
# Also, include non-file targets in .PHONY so they are run regardless of any
# file of the given name existing.
-.PHONY: $(PDF) all clean
+.PHONY: $(PDF) all clean live
# Main rule: Construct the PDF
all: $(PDF)
-#
+
# Live: automatic watch and build of the PDF file
live: $(PRINC) $(SOURCES)
- source ~/.bashrc && latexmk -pvc -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make $(PRINC)
+ $(LATEXMK) -pvc $(PRINC)
# Construct the PDF file from sources
$(PDF): $(PRINC) $(SOURCES)
- source ~/.bashrc && latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make $(PRINC)
+ $(LATEXMK) $(PRINC)
# Remove all the intermediate files
clean:
@echo Cleaning temporary LaTeX files...
- @rm -f \
- *.aux \
- *.fdb_latexmk \
- *.fls \
- *.glg \
- *.glo \
- *.gls \
- *.glsdefs \
- *.ist \
- *.lof \
- *.log \
- *.lot \
- *.out \
- *.toc \
- *.xdy
- @echo Done
-
-mrproper: clean
- @echo Removing all PDF files...
- @rm -f *.pdf
- @echo Removing all DVI files...
- @rm -f *.dvi
- @echo Done
+ @rm -rf build