%% Matteo Ciucci <[EMAIL PROTECTED]> writes:

  mc> I found that something strange happened to the -n flag from
  mc> version 3.80: it doesn't show what really make does.

When you run with -n, make can't know what your rules will _REALLY_ do
when you run them.  Instead, it simply assumes that your rules do what
you say they will do.

In this case:

  mc> speak :: a
  mc>   echo a

  mc> speak :: b
  mc>   echo b

The command script for your first rule for "speak" doesn't actually
create the target "speak", but make can't know that since it's not
running the rule.  It must assume that the command script _does_ create
the target "speak".  And, if it _DID_ create that target, then the
target would be up-to-date with relation to the "b" prerequisite, and
the second rule would never run.

You can prove this to yourself by having the command actually create the
target; change your makefile to this:

  speak :: a
        echo a
        @touch $@

  speak :: b
        echo b

When you run this without -n, you'll get the same results as with -n:

    $ make
    echo a


If that target is never supposed to exist then you should use the .PHONY
pseudo target to tell make that:

  .PHONY: speak

Then, make will behave as you expect both with -n and without it.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          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


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to