Up: Lectures

Make

November 21st, 2010 Leave a comment Go to comments

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:

  1. I have to rebuild the figures for my paper every time the data is updated. Is there a way to automate this?
  2. 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:

  1. 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.
  2. 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.
  3. Patterns (pdf, ppt)
    • Makefiles can include patterns to eliminate redundant typing.
    • Make also accepts wildcard patterns like * to help represent long lists of files.
  4. 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.
  5. 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.

  1. October 28th, 2010 at 01:30 | #1

    Where is the ‘parallel lecture’ on SCons located? Would be great to have that linked.

  2. Greg Wilson
    October 28th, 2010 at 06:10 | #2

    @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).

  3. urchgene
    November 2nd, 2011 at 13:30 | #3

    Very good introduction and thanks.