makefile:4: *** missing separator.  Stop. 

4 或者其他数字表示make停止的行数

Unlike most other DOS Make programs which accept any whitespace character at the beginning of a command in a rule, GNU Make insists that every such line begins with a TAB. (Most other Unix Make programs also require TABs, and the Posix standard requires it as well.) Make sure that the line whose number is printed in the error message (in this case, line 10) begins with a TAB. per: here

 

GNU make语法

targets(目标): prerequisites(先决条件)

  command(命令)

 

GNU make使用TAB来标识随后是一个Shell命令

使用4个空格或者其他字符代替,或者缺少这一行最开始的TAB,命令都无法被正常识别

 

Shell命令:

od -t c makefile

可以帮助你查看makefile中到底是 1 个TAB,还是 4 个空格

-t : 选择输出的格式

c : 格式为ASCII码或者转义字符

per: here

 

可以依此用TAB插入一些期望执行的动作。

例如在makefile中添加这样的最后一行以创建一个没有意义的文件fakefile:

out: a.o
    cc -o out a.o
a.o: a.c
    cc -c a.c
    touch fakefile

 

GNU make语法(补完)

targets: prerequisites; command

  command

command也可以与"target: prerequisites"处在同一行,分号分隔。

 posted on 2013-01-05 15:09  turtle_fly  阅读(1065)  评论(0编辑  收藏  举报