bug-make
[Top][All Lists]
Advanced

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

Re: False circular dependencies


From: Paul D. Smith
Subject: Re: False circular dependencies
Date: Wed, 9 Apr 2003 14:12:19 -0400

%% 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.

-- 
-------------------------------------------------------------------------------
 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




reply via email to

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