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.

Example: Creating Prologs and Epilogs<br />

How <strong>Make</strong> Finds Files<br />

With make, you can formulate recipes so that certain processes always<br />

happen before a recipe is run, or after the recipe has completed. This<br />

capability is controlled with the .PROLOG and .EPILOG attributes, and with<br />

the .GROUPPROLOG and .GROUPEPILOG special targets. Consider the<br />

makefile<br />

all: GroupWithProlog GroupWithEpilog<br />

GroupWithBoth NonGroupRecipe<br />

GroupWithProlog .PROLOG .SILENT:<br />

[<br />

echo In prolog group recipe<br />

echo<br />

]<br />

GroupWithEpilog .EPILOG .SILENT:<br />

[<br />

echo In epilog group recipe<br />

]<br />

GroupWithBoth .PROLOG .EPILOG .SILENT:<br />

[<br />

echo In prolog/epilog group recipe<br />

]<br />

.GROUPPROLOG:<br />

echo Running prolog<br />

.GROUPEPILOG:<br />

echo Running epilog<br />

echo<br />

NonGroupRecipe .PROLOG .EPILOG .SILENT:<br />

echo In non group recipe with .PROLOG and .EPILOG<br />

attributes set<br />

The .GROUPPROLOG special target defines a special recipe that gets run<br />

before a group recipe runs. Only those group recipes that have the .PROLOG<br />

attribute are so affected; all others behave normally. Similarly, the<br />

.GROUPEPILOG special target defines a special recipe that gets run after a<br />

group recipe runs, again, only for those group recipes with the .EPILOG<br />

attribute.<br />

In the previous example, the targets GroupWithProlog and<br />

GroupWithBoth have the .GROUPPROLOG recipe executed before their<br />

recipes run. The targets GroupWithEpilog and GroupWithBoth have the<br />

.GROUPEPILOG recipe executed after their recipes run.<br />

The regular recipe NonGroupRecipe has neither special recipe run, even<br />

considering that it has the .PROLOG and .EPILOG attributes. Prologs and<br />

epilogs only apply to group recipes.<br />

<strong>Using</strong> <strong>MKS</strong> <strong>Make</strong> 43

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

Saved successfully!

Ooh no, something went wrong!