Below is a simple Makefile that I usually use to compile latex document.
# Makefile to compile latex document # write the name of your main latex file here (without suffix .tex) project= tex=pdflatex bibtex=bibtex buildtex=$(tex) $(project).tex all: $(buildtex) $(bibtex) $(project) || true $(buildtex) $(buildtex) clean-all: rm -f *.dvi *.log *.bak *.aux *.bbl *.blg *.idx *.ps *.eps *.pdf *.toc *.out *~ clean: rm -f *.log *.bak *.aux *.bbl *.blg *.idx *.toc *.out *~
make to compile and generate pdf file.
make clean to clean up all unnecessary files.
Alternatively, you can do both things at the same time by running
Thanks to: Daniel Kaes