make:***没有规定制作目标' rm'需要' clean.Stop

时间:2015-06-21 07:07:35

标签: c++ makefile

我在Windows 8.1上使用cygwin。我使用了以下make文件

  .SUFFIXES : .o .C

  CFLAGS = -g2 
  CC =g++ ${CFLAGS}

  LIBRARIES =   -lm 

  .C.o :
   ${CC} -c  $<

  SOURCE-FILES =   sparsegraph.C myvarious.C pairlist.C graphlist.C peo.graph.C choldc.C copy.C metropolis_fns.C likelihood.C metropolis.C

  OBJECT-FILES =  sparsegraph.o myvarious.o pairlist.o graphlist.o peo.graph.o choldc.o copy.o metropolis_fns.o likelihood.o metropolis.o

  HEADER-FILES = sparsegraph.h pairlist.h graphlist.h myvarious.h chol.h peo.graph.h copy.h likelihood.h metropolis.h

  EXECUTABLES = metropolis

  PROGRAMS = metropolis sparsegraph myvarious pairlist graphlist peo.graph choldc copy likelihood metropolis_fns 

  metropolis: ${OBJECT-FILES}
${CC} -o $@ metropolis.o metropolis_fns.o sparsegraph.o myvarious.o pairlist.o graphlist.o peo.graph.o choldc.o copy.o  likelihood.o  ${LIBRARIES}

 metropolis.o: metropolis.C ${HEADER-FILES}

 metropolis_fns.o: metropolis_fns.C ${HEADER-FILES}

 sparsegraph.o: sparsegraph.C ${HEADER-FILES}

 myvarious.o: myvarious.C ${HEADER-FILES}

 pairlist.o: pairlist.C  ${HEADER-FILES}

 graphlist.o: graphlist.C ${HEADER-FILES}

 peo.graph.o: peo.graph.C ${HEADER-FILES}

 choldc.o: choldc.C chol.h

 copy.o: copy.C  ${HEADER-FILES}

  clean:rm *.o metropolis sparsegraph myvarious pairlist graphlist peo.graph choldc copy likelihood metropolis_fns 

然后当我使用

   make -f Makefile clean

它会抛出以下输出错误

make: *** No rule to make target 'rm', needed by 'clean'.Stop.

任何人都可以找出错误吗?以及如何解决? 谢谢大家!

1 个答案:

答案 0 :(得分:14)

与目标位于同一行的:之后的标记是该目标的依赖关系。该命令必须位于下一行,前面有一个选项卡:

clean:
    rm *.o metropolis sparsegraph myvarious pairlist graphlist peo.graph choldc copy likelihood metropolis_fns