循环,makefile中的依赖项。我该如何解决?

时间:2015-04-28 15:19:19

标签: c++ makefile

我有一个相当简单的makefile,但它在链接所有.o时崩溃以构建myprogram可执行文件。

这是错误消息:

make: Circular myprogram <- myprogram dependency dropped.
g++        -o .cpp
g++: no input files
make: *** [.cpp] Error 1

这是makefile:

CODE = myprogram

OBJS = /home/Documents/Obj/object1.o /home/Documents/Obj/object2.o /home/Documents/Obj/object3.o /home/Documents/Obj/object4.o 

default: $(CODE)

C = g++ $(CXXFLAGS) -fopenmp -g

INCLUDE = -I/home/Documents/Include/

LIBS = -lfftw3 -lm $(LIB)

%.o: %.cpp
        $(C) $(INCLUDE)  -c -o $@ $<

$(CODE): $(OBJS) $(CODE).cpp
        $(C) $(INCLUDE) -o $(CODE) $(CODE).cpp $(OBJS) $(LIBS)

clean:
        - $(RM) $(CLEAN) $(CODE) $(OBJS)

0 个答案:

没有答案