gfortran make circular dependency dropped

I'm running a makefile using GNU Make 4.1 on windows. I've seen a lot of SO links about this topic, but they all seem to be for C or c++. I'm not sure if the same rules apply, and since I'm using windows, syntax seems to be a bit different too.

Here's my make file:

 FC      = gfortran
 FCFLAGS = -O0 -Og -Wall -pedantic -fbacktrace -fcheck=all
 # FCFLAGS = -O2
 MODDIR = "bin"
 FCFLAGS += -J$(MODDIR) -fopenmp -fimplicit-none -Wuninitialized

 SRCS_C =\
    gridFun.f90 \
    test.f90

 OBJS_C   = $(SRCS_C:.c=.o)
 TARGET = test

 all: $(TARGET)

 $(TARGET): $(OBJS_C)
    $(FC) -o $@ $(FCFLAGS)  $(OBJS_C)

 $(OBJS_C): $(SRCS_C)
    $(FC) $(FCFLAGS) -c $(SRCS_C)

 cleanMod:
    del *.mod
 cleanObj:
    del *.o

I run my make file with

    gmake

and I've noticed that

    mingw32-make

seems to produce the same result. The error I'm getting is:

 gmake: Circular gridFun.f90 <- gridFun.f90 dependency dropped.
 gmake: Circular test.f90 <- gridFun.f90 dependency dropped.
 gmake: Circular test.f90 <- test.f90 dependency dropped.
 gfortran -O0 -Og -Wall -pedantic -fbacktrace -fcheck=all -J"bin" -fopenmp -fimpl
 icit-none -Wuninitialized -c gridFun.f90 test.f90
 gfortran -o test -O0 -Og -Wall -pedantic -fbacktrace -fcheck=all -J"bin" -fopenm
 p -fimplicit-none -Wuninitialized  gridFun.f90 test.f90

Any help about how to fix this, and maybe an explanation would be greatly appreciated!

Answers


You don't have c sources so the _C suffix on variables is inaccurate (harmless but confusing).

The real issue is with this OBJS_C = $(SRCS_C:.c=.o) substitution ref.

That's expecting to change .c files into .o files but you don't have any .c files.

Change that to OBJS_C = $(SRCS_C:.f90=.o) and it should work for you.


Need Your Help

Giving control to shell from a C code?

c linux shell

How can I execute shell from a C code?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.