24.10.2014 Views

Download - Tasking

Download - Tasking

Download - Tasking

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7−18<br />

PCP User’s Manual<br />

Functions<br />

A function not only expands but also performs a certain operation.<br />

Functions syntactically look like macros but have embedded spaces in the<br />

macro name, e.g. ’$(match arg1 arg2 arg3 )’. All functions are built−in and<br />

currently there are five of them: match, separate, protect, exist and<br />

nexist.<br />

match<br />

The match function yields all arguments which match a<br />

certain suffix:<br />

yields:<br />

$(match .o prog.o sub.o mylib.a)<br />

prog.o sub.o<br />

separate<br />

The separate function concatenates its arguments using the<br />

first argument as the separator. If the first argument is<br />

enclosed in double quotes then ’\n’ is interpreted as a<br />

newline character, ’\t’ is interpreted as a tab, ’\ooo’ is<br />

interpreted as an octal value (where, ooo is one to three octal<br />

digits), and spaces are taken literally. For example:<br />

$(separate "\n" prog.o sub.o)<br />

results in:<br />

prog.o<br />

sub.o<br />

Function arguments may be macros or functions themselves.<br />

So,<br />

$(separate "\n" $(match .o $!))<br />

UTILITIES<br />

protect<br />

yields all object files the current target depends on, separated<br />

by a newline string.<br />

The protect function adds one level of quoting. This<br />

function has one argument which can contain white space. If<br />

the argument contains any white space, single quotes, double<br />

quotes, or backslashes, it is enclosed in double quotes. In<br />

addition, any double quote or backslash is escaped with a<br />

backslash.

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

Saved successfully!

Ooh no, something went wrong!