I've written a makefile for my current project which produces all deliverables (executable, written in C, and report, written in LaTeX). I have a directory structure whereby the Makefile and outputs (pdf and executable) sit in the parent directory, and source code sits in a Code/ directory, and the LaTeX sits in a /Report directory, similar to:
At present the Makefile (in the Project directory) has to cd
into the Report directory before running LaTeX, a bit like the following:
Report: $(CODEFILES) $(TEXFILES) Report/Build
cd Report/; $(TEX) $(TEXARGS) Report.tex
Is there any way to tell LaTeX run as if it were in another directory, or have I done this in the best possible way? It just seems a bit of a fudge, and I'm always keen to learn of cleaner solutions!
Thanks.
Edited to update diagram, and to mention that the real problem is because Report.tex includes subfiles, preventing me from doing latex Report/Report.tex
Best Answer
(Added comment as answer)
There is nothing wrong with changing the directory (most Makefiles do this), but you should always use
cd ... && ...
, otherwise you run into trouble if thecd
fails. To place the ouput files somewhere else, use the--output-directory
command line option.