1

I have a main source file that \include a lot of other LaTeX files such as tables all named tab-XXX.tex. This way, I can have an appending that lists all the tables but this is beyond the point.

How do I set up the Makefile to automatically collect all .tex files so any changes cause the right build commands?

My Makefile is shamelessly taken from ccorn's answer:

# Tools
LATEXMK = latexmk
RM = rm -f

# Project specific settings
DOCNAME = main

# Targets
all: doc
doc: pdf
pdf: $(DOCNAME).pdf

# Rules
%.pdf: %.tex
    $(LATEXMK) -pdf -M -MP -MF $*.d $*

mostlyclean:
    $(LATEXMK) -silent -c
    $(RM) *.bbl

clean: mostlyclean
    $(LATEXMK) -silent -C
    $(RM) *.run.xml *.synctex.gz
    $(RM) *.d

.PHONY: all clean doc mostlyclean pdf

# Include auto-generated dependencies
-include *.d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.