2012-05-21 30 views
0

考虑以下几点:Overwiting目标目录

SRCS = somefile.c util/someother.c ../src/more.c 

%.o : %.c 
    $(GCC) -MD -c $< -o [email protected] -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文件中结束了./?目前他们建立在源文件存在的目录中,这很糟糕。

回答

0

我会做这种方式:

SRCS = somefile.c someother.c more.c 

%.o : %.c 
    [same as before] 

-include $(SRCS:%.c=.deps/%.P) 

vpath %.c util ../src