-2

This is my 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

And I get the following error:

Makefile:11: *** missing separator.  Stop.
letter Q
  • 14,735
  • 33
  • 79
  • 118
  • Try removing the spaces around your `=` – Jakub Arnold Nov 29 '14 at 20:42
  • 1
    You need **tabs** not **spaces** in your Makefile. –  Nov 29 '14 at 20:43
  • Unfortunately make differentiates based on spaces vs tabs :( – shuttle87 Nov 29 '14 at 20:44
  • @remyabel can I get a second opinion? I should have been clear but I definitley used a tab – letter Q Nov 29 '14 at 20:46
  • @QuinnLiu edit that into the question, it's a pretty significant piece of info. This is especially so in the case of make where they made the horrendous design decision of differentiating based on whitespace which means that we can't immediately see what's happened by just looking at the code we see on the screen (like what has happened here when looking at this question) – shuttle87 Nov 29 '14 at 20:53
  • @shuttle87 Actually it's pretty much impossible for anyone because we don't have access to the raw file, only the OP does. –  Nov 29 '14 at 20:55

1 Answers1

0

As per the make requirement,

every line in the recipe must begin with a tab character

So, in your makefile,

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

should start with a tab, not space(s).

For more information , you can check the GNU Make Error Message list.

Sourav Ghosh
  • 133,132
  • 16
  • 183
  • 261