02.05.2013 Views

Using MKS Make

Using MKS Make

Using MKS Make

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Controlling <strong>MKS</strong> <strong>Make</strong><br />

Special Macros<br />

Control Macros<br />

Target Directive Description<br />

.SOURCE.x When trying to locate a file with a name ending in the suffix<br />

.x, search first in the list of directories defined by the<br />

associated prerequisite list. The following example directs<br />

make to look in two different sets of directories for source<br />

and object file targets.<br />

.SOURCE$O : $HOME/proj/object /rd/<br />

object<br />

.SOURCE.c : $HOME/proj/src /rd/src<br />

.SUFFIXES When inferring a rule using suffix rules, the list of valid<br />

suffixes is defined by this target’s associated prerequisite list.<br />

If you specify the special target more than once, <strong>MKS</strong> <strong>Make</strong><br />

adds each list of suffixes to a single list, in the order they<br />

appear. The following example specifies four valid suffixes<br />

for use with suffix rules.<br />

.SUFFIXES : y .c $O $E<br />

To clear the list, specify this special target with an empty<br />

prerequisite list. The .SUFFIXES special target has no<br />

effect on metarule inferencing.<br />

For additional information, see “Suffix Rules” on page 50.<br />

Special macros usually behave like macros, except they can hold special<br />

kinds of information. <strong>MKS</strong> <strong>Make</strong> supports two kinds of special macros;<br />

control macros and runtime macros.<br />

Control macros control <strong>MKS</strong> <strong>Make</strong>’s behavior. A control macro having the<br />

same function as an attribute, also has the same name.<br />

<strong>MKS</strong> <strong>Make</strong> defines the runtime macros during the process of making targets.<br />

Runtime macros usually only serve a useful purpose within recipes; they can<br />

expand to contain the name of prerequisites or targets within recipes.<br />

Dynamic prerequisite macros (a special type of runtime macro), however,<br />

serve a useful function when used in prerequisite lists; they can refer to the<br />

associated target’s name (in full, or in part).<br />

<strong>MKS</strong> <strong>Make</strong> groups control macros into two sets: string-valued macros and<br />

attribute macros.<br />

<strong>MKS</strong> <strong>Make</strong> automatically creates internally defined macros. For example,<br />

you can use $(PWD) to expand to the name of the present working directory.<br />

34 <strong>MKS</strong> Toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!