[manual index][section index]

NAME

mash-make - builtin `make' functionality

SYNOPSIS

load make make [ -clear ]
depends [ target ]
match pattern
rules [ pattern ]

DESCRIPTION

Make is a loadable builtin for mash. It can be taught about dependencies that exist between components of a program and rules for reconstructing the components of a program.

Make will examine file modification times to determine which components need to be updated and will issue commands to reconstruct them in the correct sequence. It will update a target if any of its prerequisites are more up to date than the target or if the target does not exist.

Typically, dependencies and rules are kept in a file called mashfile. The sequence

	load make
	run mashfile

is used to load the make builtin and read the rules from mashfile. Thereafter, the command

make target

will perform the correct sequence of operations to reconstruct target and its dependents.

A dependency is specified in mash with a line of the form:

target-list : dependent-list ;

or

target-list : dependent-list { rules } ;

Each of the targets in target-list depends upon each of the dependents in dependent-list. The optional rules specify how to build the targets. For example

	lflags = -Cg;
	rotta.dis : rotta.b rotta.m { limbo $lflags rotta.b };
If the rules are omitted make must be able to infer them from implicit rules.

An implicit rule is defined with a line of the form:

pattern :~ dependency { rules }

If pattern matches a target that make needs to build then make will build the target by first making the dependency and then applying the rules. The wildcard components of the matched target are available in the dependency and the rules as variables $1, $2, $3... with $1 containing the text matched by the first wildcard, $2 the second wildcard and so on. The whole of the target is available in the variable $0. For example,

    /*/*.m :~ $2.m  { cp $2.m /$1/$2.m };
    /module/rotta.m: rotta.m;
    /altmodule/frame.m: frame.m;

More commonly, implicit rules are defined to provide make with knowledge of how to compile limbo source to produce Dis format binaries. Typically,

    *.dis       :~ $1.b     { limbo $lflags $1.b};
    /dis/*.dis  :~ $1.dis   { cp $1.dis /dis};

A target is built with the command

make target

The list of rules can be reset with

make -clear

The list of dependencies for a target or for all targets can be displayed with the command

depends [ target ]

The rules that match a pattern and the components of the pattern can be displayed with

match 'pattern'

Taking care to hide the pattern from mash file name pattern matching with quotes. The command

rules [ pattern ]

will display all the rules or the rules that apply to pattern pattern (if given).

SOURCE

/appl/cmd/mash/make.b

SEE ALSO

mash(1)

MASH-MAKE(1 ) Rev:  Tue Mar 31 02:42:38 GMT 2015