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

01.26.2006
| 4682 views |
  • 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

http://www.wlug.org.nz/MakefileHowto
http://www.gnu.org/software/make/manual/html_chapter/make.html

TEXFILE=report

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)
images:
	$(MAKE) -C images 

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