Make
These episodes introduce a build tool called Make; a parallel lecture introduces an alternative build tool called SCons.
Requires: The Unix Shell
Introduces: Make, a tool for automating processes
Motivating questions:
- I have to rebuild the figures for my paper every time the data is updated. Is there a way to automate this?
- My program consists of 10 files of FORTRAN with several interdependencies. How can I automatically rebuild the files that are affected by a change?
Lectures:
- Introduction (pdf, ppt)
- Any task that is worth repeating is worth automating
- Most tasks come with a set of dependencies that have to be fulfilled first.
- Make is a widely used tool for automating tasks that involve dependencies.
- Basics (pdf, ppt)
- Makefiles list prerequisites for a task and the set of commands to recreate that task.
- Make automatically reruns a task if any of its prerequisites are more up to date that the current output.
- Patterns (pdf, ppt)
- Makefiles can include patterns to eliminate redundant typing.
- Make also accepts wildcard patterns like * to help represent long lists of files.
- Rules (pdf, ppt)
- Sometimes redundant Makefile statements can be combined using pattern rules.
- Be careful, however, that the original tree of dependencies is preserved and that rules containing a wildcard aren’t intended to match files that are created by the Makefile itself.
- Macros (pdf, ppt)
- Like any other programming language, Make allows the introduction of variables.
- Variables are declared using a = and accessed by typing ${VARIABLE}
- Make also allows the declaration of config files that help define variables when the program needs to run on machines with different operating systems.

Where is the ‘parallel lecture’ on SCons located? Would be great to have that linked.
@John Pye
The SCons lecture doesn’t exist yet—if you’d like to help us write it, please let me know (as with any open source project, contributions are always very welcome).
Very good introduction and thanks.