Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile for dummies? Mac OS X

I am having trouble understanding an answer to a previous question I asked here on stackoverflow located at:

More efficient R / Sweave / TeXShop work-flow?

The answer in particular is from user: las3rjock who suggests creating a "makefile" and running the makefile to automate compilation of a .Rnw in R (Sweave) and then in LaTeX. I don't know what a makefile is, or how to use it in Terminal (?) on Mac OS X. My internet searching has returned things above my knowledge level. I guess I need some hand holding to create and run a makefile.

Could anyone give "dummy" instructions on how to create a makefile to run Sweave / LaTeX, or more to the point, utilize the answer from las3rjock in the previous question? Thank you!

like image 860
baha-kev Avatar asked Feb 07 '11 16:02

baha-kev


People also ask

Does makefile work on Mac?

To specify a number of files with various paths and to save this information for multiple compilations, you can use a makefile. On Linux and Mac OS systems: To use a makefile to compile your input files, make sure that /usr/bin and /usr/local/bin are in your path.

What is makefile and how do you use it?

The make utility requires a file, Makefile (or makefile ), which defines set of tasks to be executed. You may have used make to compile a program from source code. Most open source projects use make to compile a final executable binary, which can then be installed using make install .

What is $@ in makefile?

$@ is the name of the target being generated, and $< the first prerequisite (usually a source file). You can find a list of all these special variables in the GNU Make manual.


1 Answers

I wrote a post with links on getting started with makefiles for Sweave.

From the post:

  • Ross Ihaka has a quick introduction to makefiles focusing on Sweave, R, and LaTeX
  • Charlie Gibbons wrote a document with LaTeX, Sweave, and Beamer examples of makefiles
  • Gregor Gorjanc shows an example Sweave make file using his custom Sweave command
  • Documentation on GNU Make

I also posted four sample Sweave documents. Each one has full source code available on github. Each one uses a makefile. In the first two tutorials, details of the makefile are described:

  • Sweave Tutorial 1
  • Sweave Tutorial 2
  • Sweave Tutorial 3
  • GitHub Repository of what will be Sweave Tutorial 4
like image 141
Jeromy Anglim Avatar answered Oct 21 '22 20:10

Jeromy Anglim