DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(make.info.gz) Execution

Info Catalog (make.info.gz) Echoing (make.info.gz) Commands (make.info.gz) Parallel
 
 5.3 Command Execution
 =====================
 
 When it is time to execute commands to update a target, they are
 executed by invoking a new subshell for each command line.  (In
 practice, `make' may take shortcuts that do not affect the results.)
 
    *Please note:* this implies that setting shell variables and
 invoking shell commands such as `cd' that set a context local to each
 process will not affect the following command lines.(1)  If you want to
 use `cd' to affect the next statement, put both statements in a single
 command line.  Then `make' will invoke one shell to run the entire
 line, and the shell will execute the statements in sequence.  For
 example:
 
      foo : bar/lose
              cd $(@D) && gobble $(@F) > ../$@
 
 Here we use the shell AND operator (`&&') so that if the `cd' command
 fails, the script will fail without trying to invoke the `gobble'
 command in the wrong directory, which could cause problems (in this
 case it would certainly cause `../foo' to be truncated, at least).
 

Menu

 
* Choosing the Shell          How `make' chooses the shell used
                                   to run commands.
 
    ---------- Footnotes ----------
 
    (1) On MS-DOS, the value of current working directory is *global*, so
 changing it _will_ affect the following command lines on those systems.
 
Info Catalog (make.info.gz) Echoing (make.info.gz) Commands (make.info.gz) Parallel
automatically generated byinfo2html