Tuesday, November 23, 2010

makefiles for Sweave, R and LaTeX using Eclipse on Windows

This post provides a brief introduction to make and makefiles.
In particular it describes how to set up make on Windows with an emphasis on using make in Eclipse on projects involving R, Sweave, and LaTeX.

Overview

make is software that uses makefiles to build projects.
make has many benefits.

One click build

Reliable build (always build derived files that need to be built; i.e., ensure build is up to date)

make has also encouraged me to think more about dependencies, one-click builds, and project file structures.
Specifically, I use make in conjunction with R, Sweave, LaTeX, and other command line tools to build reproducible research output.
I'll post some examples in the near future.

Thus, with a makefile in the root directory of a project, Run - External Tools - Make runs the makefile.

Also note:

Whenever a directory is added to the Windows Path, Eclipse needs to be restarted for this to take effect.
Sometimes it seems that Windows itself has to be restarted.

Editing makefiles in Eclipse requires the use of tabs. The following setting enables tabs instead of space substitution (Window - Preferences - General - Editors - Text Editors - Insert Space for Tables (uncheck)); or edit the makefile in another text editor such as notepad.

I am a lecturer at Deakin University bridging I/O psychology and statistics. My blog contains 100+ posts focused on data analysis in the social sciences.
If you're new, check out the
Site Map.
If you love R, check out the
40+ posts on R. If you want to follow the blog, see the RSS and email subscription options.

Disclaimer

This page, its contents and style, are the responsibility of the author and do not necessarily represent the views, policies or opinions of any current, present, or future employer.The information on this internet site is provided without any express or implied warranty as to its accuracy or currency. Any use of this information is at your own risk.