4.7. DEFCON 2 – The Number of the Beast
Prev | Chapter 4. PMake for Gods | Next

## 4.7. DEFCON 2 – The Number of the Beast

Then there are the makefiles that expect certain commands, such as changing to a different directory, to not affect other commands in a target's creation script. You can solve this is either by going back to executing one shell per command (which is what the `-B` flag forces PMake to do), which slows the process down a good bit and requires you to use semicolons and escaped newlines for shell constructs, or by changing the makefile to execute the offending command(s) in a subshell (by placing the line inside parentheses), like so:

install :: .MAKE (cd src; $(.PMAKE) install) (cd lib; $(.PMAKE) install) (cd man; $(.PMAKE) install)

This will always execute the three makes (even if the `-n` flag was given) because of the combination of the `::` operator and the `.MAKE` attribute. Each command will change to the proper directory to perform the install, leaving the main shell in the directory in which it started.

Prev | Up | Next
4.6. DEFCON 3 – Variable Expansion | Home | 4.8. DEFCON 1 – Imitation is the Not the Highest Form of Flattery

This, and other documents, can be downloaded from http://ftp.FreeBSD.org/pub/FreeBSD/doc/

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.