[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug/feature regarding target filename resolution
From: |
Paul D. Smith |
Subject: |
Re: bug/feature regarding target filename resolution |
Date: |
Sun, 30 Jun 2002 00:24:45 -0400 |
%% Hua Yu <address@hidden> writes:
hy> Well, I also noticed that gmake produces a different message in
hy> this case, comparing to when it gets a non-existent target. If
hy> target names are strings, the "No rule to make target ..." message
hy> is much clearer and easier for me to debug the makefile.
hy> $ pwd
hy> /home/hyu
hy> $ cat Makefile
hy> a.o: a.c
hy> touch a.o
hy> $ touch a.c
hy> $ gmake ../hyu/a.o
hy> gmake: Nothing to be done for `../hyu/a.o'.
hy> $ gmake whatever
hy> gmake: *** No rule to make target `whatever'. Stop.
The reason you get different results is that "../hyu/a.o" exists, while
"whatever" doesn't.
If you "touch whatever", then run "gmake whatever", you'll get the
"Nothing to be done for ..." message there as well.
What happens is that make can't find a rule to build the target, but the
target does exist, so make assumes it's up to date and gives the proper
message. After all, remember if you list a header file as a
prerequisite remember make will try to build that as well: you wouldn't
want to get an error like "no rule to make target" if you didn't have a
rule to build the .h file (which you probably don't).
On the other hand, if the file is a prerequisite, doesn't exist, and
make can't find any way to create it, then you get a "no rule to make
target" error.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist