老师,我想问一个关于makefile的问题,能不能帮我看看?
来源:6-15 内存泄漏
mahsiaoko
2020-04-27
CC = g++ # GDB= -g -pg GDB= -g CFLAGS = -w -lstdc++ -O0 ${GDB} LIBS =-lpqxx -lpq -lrdkafka -lrdkafka++ -lconfig++ LIBDIR=-L/usr/lib -L/usr/local/lib SHELL := /bin/bash SRCS := $(wildcard *.cpp) OBJS := $(patsubst %cpp, %o, $(SRCS)) TARGET := $(patsubst %.cpp, %, $(SRCS)) SUBDIRS:= insertpg ../../utils OBJS_UTILS=../../utils/StringUtil.o export CC CFLAGS LIBS all: $(TARGET) ${TARGET}:%:%.o $(SUBDIRS) ${CC} $(CFLAGS) $< -o $@ $(addprefix insertpg/, $(addsuffix .o, $(shell echo $(patsubst myProducer%, ,$(subst _,,$(subst myConsumer_,, $(patsubst myConsumer_%_v6PG, V6%PG,$(addsuffix PG, $@)))))|tr a-z A-Z))) ${OBJS_UTILS} $(LIBS) ${OBJS}:%.o:%.cpp $(CC) -c $(CFLAGS) $< -o $@ $(SUBDIRS):ECHO +$(MAKE) -C $@ ECHO: @echo $(SUBDIRS) @echo begin compile batchimport/project_1....... .PHONY : clean clean : for dir in $(SUBDIRS);\ do $(MAKE) -C $$dir clean||exit 1;\ done -@rm $(TARGET) $(OBJS)
如上,运行时候总是会报错;
这个是什么原因,我单独编译的时候不会出错。求老师指点一下
写回答
1回答
-
目前来说我们这里只解决课程相关的问题。你好好看下makefile的依赖关系。
00
相似问题