Prime Mover / About Prime Mover

About Prime Mover

Page Contents

1. Introduction

Prime Mover (pm for short) is a build tool, not unlike make. It is designed to be small, portable, flexible, powerful, and is very easy to deploy. It can be distributed along with your application source code and does not require your end user to have anything other than a basic C compiler in order to use it.

pm differs from make primarily in that all dependencies in pm are explicit. make will attempt to determine what needs to be done to build a file, based on a set of rules that tell it how to transform file types. This works well until you need to have different rules apply to two files of the same type... which then causes make to quickly become unmanageable.

pm avoids this by requiring all rules to be explicit. Thanks to the power of syntactic sugar, it is much less work than it sounds, never fear.

The best explanation is an example, and so here is an example pmfile that will build a simple C program:

-- load the C rules
include "c.pm"

-- default target builds a C program
default = cprogram {
    -- cfile transforms a C source file into an object file
    cfile "main.c",
    cfile "utils.c",
    cfile "aux.c",

    -- once built, this makes the result available
    install = pm.install("myprogram")
}

If this is saved as "pmfile" in the current directory, it can be invoked by simply doing:

./pm

...and it will run.