[Top][All Lists]

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

Re: False circular dependencies

From: Ted Stern
Subject: Re: False circular dependencies
Date: Wed, 09 Apr 2003 12:07:24 -0700
User-agent: Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.2 (usg-unix-v)

On 9 Apr 2003, Paul D. Smith wrote:
>%% Miguel Nicolau <address@hidden> writes:
>mn> I have this strange problem with Make (tried both 3.79.1 and
>mn> 3.80). I use include files without an extension, i.e. the
>mn> "Genotype.cpp" file uses an include file called "Genotype".
>mn> g++ -Wall -c main.cpp -o main.o
>mn> make: Circular Genotype <- Genotype.o dependency dropped.
>Make has a builtin rule that knows how to build programs (files with no
>suffix) from a .o file.
>You have a file "Genotype", with no suffix, so make looks for a
>"Genotype.o" to see if that builtin rule matches, and so it does.  But
>since it's circular (Genotype.o -> Genotype -> Genotype.o -> Genotype -> ...)
>it gives that error.
>You need to remove the builtin rule, then the problem will go away; add
>these lines to your makefile:
>%: %.o
>%: %.c
>%: %.cpp
>This will turn off those default rules.

Alternatively, you could use the -r or --no-builtin-rules flag.  Personally, I
almost always use the -R or --no-builtin-variables flag (which automatically
enables -r as well), since I prefer to tell GNU make *exactly* what I expect it
to do.

 Ted Stern                                 Applications Group
 Cray Inc.                               office: 206-701-2182
 411 First Avenue South, Suite 600         cell: 206-383-1049
 Seattle, WA 98104-2860                     FAX: 206-701-2500

 Frango ut patefaciam -- I break in order to reveal
 (motto of The Paleontological Society, just as apropos for debugging)

reply via email to

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