Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Circular dependency dropped

milenko1976
Beginner
2,412 Views
Again I have this problem.Trying to compile one program,changed it slightly but I get this:
make: Circular findiff2d <- findiff2d.o dependency dropped.
findiff2d calls 9 subroutines some of them are called from main program too.Is that problem?
This is my makefile:
77 = ifort
LD = ifort
CPPFLAGS = -C -traditional $(DFLAGS) -I$(INTEL_INC)
FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -fpp -g
LDFLAGS = $(FCFLAGS)
LIBS = -L$(INTEL_LIB) -lmkl_intel_lp64
OBJECTS_ARCHITECTURE = machine_intel.o


# Executables
main: main.o model.o time.o findiff2d.o misc.o blkdat.o fd.par fd.com
$(F77) $(FLAGS) -o main main.o model.o time.o findiff2d.o misc.o blkdat.o

# Object files
main.o: main.f fd.par fd.com
$(F77) $(FLAGS) -c main.f -o main.o
model.o: model.f fd.par fd.com
$(F77) $(FLAGS) -c model.f -o model.o
time.o: time.f fd.par fd.com
$(F77) $(FLAGS) -c time.f -o time.o
findiff2d.o: findiff2d fd.par fd.com
$(F77) $(FLAGS) -c findiff2d.f -o findiff2d.o
misc.o: misc.f fd.par fd.com
$(F77) $(FLAGS) -c misc.f -o misc.o
blkdat.o: blkdat.f fd.par fd.com
$(F77) $(FLAGS) -c blkdat.f -o blkdat.o
0 Kudos
4 Replies
TimP
Honored Contributor III
2,412 Views
You appear to have introduced so many typos we can't judge accurately about your question.
Might the correct version involve

findiff2d.o: findiff2d.f ...... ?

Apparently, what you put there implies findiff2d.o depends on itself, a seemingly likely interpretation.

It doesn't make sense to introduce -lmkl_intel_lp64 by itself, but you don't show how you might use it.
0 Kudos
milenko1976
Beginner
2,412 Views
Thanks Tim.
Regarding -lmkl_intel_lp64,I copied makefile from my another program.Changing findiff2d.o: findiff2d.f doesn't solve the problem.
0 Kudos
mecej4
Honored Contributor III
2,412 Views
The make utility does not concern itself with the contents of the source files it is about to hand over to compilers to process.

There is a built in make rule that says that linking xxxxx.o produces the executable xxxxx, in the absence of other information provided in the makefile for building xxxxx.

Since, because of you mistake in leaving out ".f" after findiff2d, as Tim18 pointed out already, findiff2d is declared a prerequisite to findiff2d.o, and make tries to figure out how to build it.

Since there is no explicit rule given to make this prerequisite, findiff2d, make uses the built-in rule, which in effect makes the following rules apply:

findiff2d.o: findiff2d # explicit rule
findiff2d: findiff2d.o # built-in rule

The circular dependency is now clearly seen.

The fix, as Tim18 stated, is to replace the erroneous line

findiff2d.o: findiff2d fd.par fd.com

by

findiff2d.o: findiff2d.f fd.par fd.com

To see how make applies built in rules, try the command

make misc
0 Kudos
milenko1976
Beginner
2,412 Views
Thanks Mecej,now I see what is wrong.
0 Kudos
Reply