help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: order of evaluation


From: Paul D. Smith
Subject: Re: order of evaluation
Date: Thu, 5 Sep 2002 16:22:59 -0400

%% Dan DeJohn <address@hidden> writes:

  dd> In the list of commands for a rule, I want to execute a particular
  dd> command (mv a file) only if one of the previous commands created
  dd> the file.

All lines of a command script are evaluated at once, right before the
first line is executed.

So, the $(if ...) and $(wildcard ...) functions are being evaluated
before the touch command is run.

  dd> don't know how to get the proper conditional execution of my mv
  dd> command.

You'll have to use shell constructs, not make constructs, to do what you
want:

  all:
      touch xxx.abc
      @if [ -f xxx.abc ]; then echo YES; else echo NO; fi

or something like that.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]