Reputation:
I'm write the following makefile:
TARGET=fmake
TARGET2=test_second
f:f
echo Some text
clean:
rm -f fmake test_second
CC=$(VAR2)
VAR2=gcc
After make command I have:
make: Circular f <- f dependency dropped.
echo Some text
Some text
What does mean make: Circular f <- f dependency dropped.
Is it true that
f:f
echo Some text
just equivalent to
f:
echo Some text
Upvotes: 1
Views: 27
Reputation: 100836
No, it's not true that f: f
is the same as f:
. The latter defines a target f
which doesn't depend on any other files. The former defines a target f
which depends on a file f
(the same file).
This is an impossible situation, because f
cannot be updated before itself. Before f
can be built make will try to build its prerequisites, which are f
. But before the prerequisite f
can be built make must build its prerequisite, which is f
. And before that can be built make must build its prerequisite which is also f
. Etc. forever and ever.
There are different things make could do when it finds this impossible situation. It could, for example, just fail with an error code.
But instead what make chooses to do is drop the prerequisite to avoid the recursion. That's what the warning message you see means.
So in effect although they are not the same thing, make does end up treating f:f
as if it were just f
.
Upvotes: 2