Skip to content

Instantly share code, notes, and snippets.

@ljvmiranda921
Last active September 10, 2018 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljvmiranda921/a9368c636cbf6dafbbf0a1979047aaca to your computer and use it in GitHub Desktop.
Save ljvmiranda921/a9368c636cbf6dafbbf0a1979047aaca to your computer and use it in GitHub Desktop.
Contains a minimal workflow for compiling LaTeX documents
# A Simple Makefile for LaTeX
# Author: Lester James V. Miranda
# E-mail: ljvmiranda@gmail.com
# Default variables which can be edited via the terminal
BUILDDIR = _build
COMPILER = pdflatex
PROJECT = main
BIBLIOGRAPHY = bibliography
latex:
@echo "Building $(PROJECT) in $(BUILDDIR) directory using $(COMPILER)..."
@echo "Creating $(BUILDDIR) directory..."
@mkdir $(BUILDDIR)
@mkdir $(BUILDDIR)/appendices
@mkdir $(BUILDDIR)/chapters
@$(COMPILER) -interaction=nonstopmode -halt-on-error -output-directory=$(BUILDDIR) $(PROJECT).tex
@echo "First pass (via $(COMPILER)) done!"
@cp $(BIBLIOGRAPHY).bib $(BUILDDIR)
@biber --output_directory=$(BUILDDIR) $(PROJECT)
@echo "Second pass (via bibtex) done!"
@$(COMPILER) -interaction=nonstopmode -halt-on-error -output-directory=$(BUILDDIR) $(PROJECT).tex
@echo "Third pass (via $(COMPILER)) done!"
@$(COMPILER) -interaction=nonstopmode -halt-on-error -output-directory=$(BUILDDIR) $(PROJECT).tex
@echo "Fourth pass (via $(COMPILER)) done!"
@echo "Compilation done. Output file can be seen in $(BUILDDIR)"
clean:
@rm -rf $(BUILDDIR)
@echo "Removed $(BUILDDIR) directory"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment