[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does make behave like this?
From: |
Paul D. Smith |
Subject: |
Re: Why does make behave like this? |
Date: |
Mon, 27 Mar 2006 10:21:41 -0500 |
%% Rodrigo de Salvo Braz <address@hidden> writes:
rdsb> all: temp/t1 temp/t2
rdsb> echo Ok
rdsb> temp/t%: t%
rdsb> mkdir -p temp
rdsb> ls > $@
rdsb> t1:
rdsb> ls > t1
rdsb> ls > t2
rdsb> When I run 'make', I get the output:
rdsb> ls > t1
rdsb> ls > t2
rdsb> mkdir -p temp
rdsb> ls > temp/t1
rdsb> make: *** No rule to make target `temp/t2', needed by `all'. Stop.
rdsb> My question is why do I get this error message? I expected the rule
rdsb> temp/t%: t%
Because make thinks there is no file "t2", so it can't apply the pattern
you expect it to. Make caches the contents of the directory when it
start, and it didn't run any rule that told it t2 would be created, so
as far as make is concerned no file t2 exists.
Your rule for t1 is "magically" creating files behind make's back, so
make doesn't know about them and doesn't believe they exist.
--
-------------------------------------------------------------------------------
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