DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Makefile For Latex

  • submit to reddit
        this is a sample makefile to build a latex report with pdflatex. all images are build from a makefile in the subdirectory images/ (see my other Makefile)

I found those websites useful when building the makefile


all: $(TEXFILE).pdf

# .PHONY tells make that these rules don't create any file
# --> if there is a file called all it will still run
.PHONY: all clean images

%.pdf: %.tex images
	pdflatex $<
	pdflatex $<

# for subdirectories use the variable $(MAKE)
# -C path/to/directory to tell in which directory to run
#  --> note: use environment variables like this $(VARIABLE)
	$(MAKE) -C images 

	$(MAKE) clean -C images
	rm -f *.aux *.log