Makefile returning error "Missing Separator"

1

I'm trying to run a makefile that compiles programs in 'C'.

TARGET=client server 
CC= gcc
CFLAGS= -Wall -Wextra -g 
LDFLAGS = -lm -pthread -lncurses
DEPS = util.h

normal: $(TARGET)

client: client.c
    $(CC) $(CFLAGS) client.c -o client $(LDFLAGS)

server: server.c
    $(CC) $(CFLAGS) server.c -o server $(LDFLAGS)

clean:
    $(RM) $(TARGET)

But the following error is returned when I run the terminal (make client):

Makefile:9: *** missing separator.  Stop.
    
asked by anonymous 15.01.2018 / 14:00

1 answer

1

This error is very common when you use space instead of tab to determine an action.

You can check if you used tab or space using this command line in the terminal:

cat -e -t -v  makefile

If tab was used it will appear ^I otherwise it will be blank.

Ex. in the first action the tab is correct and the second is not:

$(FILE).tex: $(FILE).Rnw$
^IRscript -e "knitr::knit('$<')"$
$
$(FILE).tex: $(FILE).Rnw$
  Rscript -e "knitr::knit('$<')"$

source: link

    
19.03.2018 / 23:20