Commit 80ce0ed2 authored by Maxime Bombar's avatar Maxime Bombar

Update Makefile

parent a2c4fd6a
......@@ -2,40 +2,74 @@
#
# Requires latexmk.
# latexmk is a swiss army knife of latex compilation. Option -pdf to output the pdf.
PDFLATEX = latexmk -pdf $<
CMD = cat main.log | grep -iE
REGEXBOX = full..hbox
WARNINGS = warning
## This Makefile is used to build pdf from a latex project. Use ```make help``` to display a summary of the rules.
## ```make MyFancyProject.pdf``` will build MyFancyProject.pdf (and auxiliary files) from MyFancyProject.tex and fail if it doesn't exist.
##
.PHONY: docs help clean cleanall
SHELL = /bin/bash
all: main.tex
$(PDFLATEX);
rebuild: clean all
# latexmk is a swiss army knife of latex compilation. Option -pdf to output the pdf.
PDFLATEX := latexmk -pdf
CMD = cat $*.log | grep -iE
CMDMAIN = cat main.log | grep -iE
REGEXBOX := full..hbox
WARNINGS := warning
# Display how many warnings there are.
warnings: all
@echo "${shell echo $(\n)}"
TEXDOCS = $(wildcard *.tex)
PDF := $(patsubst %.tex,%.pdf, $(TEXDOCS))
OUT := $(patsubst %.tex,%.out, $(TEXDOCS))
LOG := $(patsubst %.tex,%.log, $(TEXDOCS))
%.pdf: %.tex
$(PDFLATEX) $<
@echo "${shell echo 'There are $$(( $$($(CMD) $(WARNINGS) | wc -l)-1 ))' warning\(s\)}"
@echo "${shell echo 'There are $$($(CMD) $(REGEXBOX) | wc -l)' bad boxe\(s\)}"
@echo "${shell echo 'There are $$($(CMD) $(REGEXBOX) | wc -l)' bad boxe\(s\)}"
## all : build every file.
all:
$(PDFLATEX)
## rebuild : clean and rebuild all files.
rebuild: cleanall all
# Display all warnings.
showwarnings: all
## warnings : Display how many warnings and bad boxes are found when compiling main.tex
warnings: main.tex
$(PDFLATEX) $<
@echo "${shell echo $(\n)}"
@echo "${shell echo 'There are $$(( $$($(CMD) $(WARNINGS) | wc -l)-1 ))' warning\(s\):}"
@echo "${shell echo '$$( $(CMD) $(WARNINGS) | tail +2)' }"
@echo "${shell echo 'There are $$(( $$($(CMDMAIN) $(WARNINGS) | wc -l)-1 ))' warning\(s\)}"
@echo "${shell echo 'There are $$($(CMDMAIN) $(REGEXBOX) | wc -l)' bad boxe\(s\)}"
## showwarnings : Display all warnings and bad boxes that are found when compiling main.tex
showwarnings: main.pdf
$(PDFLATEX) $<
@echo "${shell echo $(\n)}"
@echo "${shell echo 'There are $$($(CMD) $(REGEXBOX) | wc -l)' bad boxe\(s\):}"
@echo "${shell echo '$$( $(CMD) $(REGEXBOX))' }"
@echo "${shell echo 'There are $$(( $$($(CMDMAIN) $(WARNINGS) | wc -l)-1 ))' warning\(s\):}"
@echo "${shell echo '$$( $(CMDMAIN) $(WARNINGS) | tail +2)' }"
@echo "${shell echo $(\n)}"
@echo "${shell echo 'There are $$($(CMDMAIN) $(REGEXBOX) | wc -l)' bad boxe\(s\):}"
@echo "${shell echo '$$( $(CMDMAIN) $(REGEXBOX))' }"
.PHONY: clean
## clean : remove auto-generated files but not pdf.
clean:
latexmk -C
@echo -n "aux bbl blg fdb_latexmk fls log toc dvi"|xargs -t -d ' ' -n 1 -I {} find . -iname "*{}" -delete
@echo -n "aux bbl blg dvi fdb_latexmk fls tdo toc"|xargs -t -d ' ' -n 1 -I {} find . -iname "*.{}" -delete
rm -f $(OUT)
rm -f $(LOG)
find . -iname "*flymake*" -delete
find . -iname "*~" -delete
find . -iname "\#*" -delete
find . -type d -iname 'auto' -exec rm -rf {} +
## cleanall : remove all auto-generated files.
cleanall: clean
rm -f $(PDF)
## help : display this help.
help: Makefile
@sed -n 's/^##//p' $<
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment