缺少分隔符。在C中使用Makefile停止错误

时间:2014-11-29 20:40:59

标签: c makefile

这是我的Makefile

# Makefile to build web server

CC = gcc # gcc = c compiler

CFLAGS = -std=c99 -ggdb3 -static -Wall -O3 -Werror

OBJECTS = webserver.o

# Build web server as exectuable called "make clean all" by typing "make clean all" in terminal
all: $(OBJECTS)
    $(CC) $(CFLAGS) -o sysstatd # <============= THIS LINE DEFINITELY STARTS WITH TAB

webserver.o: webserver.c

clean:
    rm -rf *.o sysstatd

我收到以下错误:

Makefile:11: *** missing separator.  Stop.

1 个答案:

答案 0 :(得分:0)

根据make要求,

  

配方中的每一行都必须以制表符

开头

所以,在你的makefile中,

$(CC) $(CFLAGS) -o sysstatd # <============= THIS LINE

应以tab开头,而不是空格。

有关详细信息,请查看GNU Make Error Message list