为什么我在此代码中出现依赖项丢弃错误?
里面一定有问题,但我找不到这个问题!这里我有自动依赖生成器。这里我有自动依赖生成器。没有最后一行:
-include $(DEPFILES)
运行正常。但是当这段代码存在时,它会给我错误。
请避免因为类似的警告信息而链接到其他问题。他们的情况不同。
输出:
bash ./scripts/outputs.bash
bash ./scripts/simulator_outputs.bash
make: Circular /usr/include/c++/4.8/iostream <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/ostream <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/ios <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/iosfwd <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/cwchar <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/exception <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/clocale <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/cctype <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/string <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/new <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/basic_string.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/locale_classes.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/streambuf <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/streambuf.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/cwctype <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/locale_facets.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/basic_ios.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/ostream.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/istream <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/bits/istream.tcc <- bin/sim dependency dropped.
make: Circular /usr/include/c++/4.8/cmath <- bin/sim dependency dropped.
make: `VARLISTS' is up to date.
生成文件:
SOURCES := test.cpp
OUTDIR:= ./out
BINDIR:= ./bin
OBJDIR:= ./bin/obj
OBJECTS := $(addprefix $(OBJDIR)/,$(SOURCES:.cpp=.o))
DEPFILES:= $(OBJECTS:.o=.d)
VARLISTS:= ./app/outputs.list
CXX := g++
CXXFLAGS := -c -g -MD -MP
# default
%: VARLISTS $(BINDIR)/sim
@
VARLISTS:
bash ./scripts/outputs.bash
bash ./scripts/simulator_outputs.bash
$(BINDIR)/sim: $(OBJECTS)
$(CXX) $(LDFLAGS) $^ -o $@
$(OBJDIR)/%.o: %.cpp
@if [ ! -d "$(OBJDIR)" ]; then mkdir -p $(OBJDIR) && echo "$(OBJDIR) directory created: $(OBJDIR)"; fi
$(CXX) $(CXXFLAGS) -MF $(OBJDIR)/$*.d -o $@ $<
-include $(DEPFILES)
答案 0 :(得分:0)
问题是%: VARLISTS $(BINDIR)/sim
行。
该行是match-anything rule,因此匹配所有目标。因此$(BINDIR)/sim
依赖的所有内容(没有其他目标)也将(循环地)依赖于$(BINDIR)/sim
文件/目标。