请考虑以下几点:
SRCS = somefile.c util/someother.c ../src/more.c
%.o : %.c
$(GCC) -MD -c $< -o $@ -Wp,-MD,.deps/$*.d
@cp .deps/$*.d .deps/$*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < .deps/$*.d >> .deps/$*.P; \
rm -f .deps/$*.d
-include $(SRCS:%.c=.deps/%.P)我如何更改上面的代码,使.o文件以./结尾?目前,它们是在源文件所在的目录中构建的,这很糟糕。
发布于 2012-05-22 23:58:27
我会这样做:
SRCS = somefile.c someother.c more.c
%.o : %.c
[same as before]
-include $(SRCS:%.c=.deps/%.P)
vpath %.c util ../srchttps://stackoverflow.com/questions/10690291
复制相似问题