Makefile returning "Missing Separator" error

Asked

Viewed 2,799 times

1

I am trying to run a Makefile that Compile 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 running on the terminal (make client):

Makefile:9: *** missing separator.  Stop.
  • It’s not "Missing separator"?

  • the title is different from what you claim

  • Yes, my mistake. It’s even Missing separator

  • You used spaces to determine the line of code to be executed?

1 answer

2

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

You can check if used tab or space using that command line on the terminal:

cat -e -t -v  makefile

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

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

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

source: https://stackoverflow.com/a/16945143/6532002

Browser other questions tagged

You are not signed in. Login or sign up in order to post.