M_Row
M_Row

Reputation: 119

Makefile saying Missing Operator

I am trying to run a makefile that compiles these 'C' programs at the same time.

CC=gcc
CFLAGS=-I.
DEPS = queue.h

all: \threadss

threadss: thread.o queueImp.o
    $(CC) thread.o queueImp.o -o threadss

thread.o: thread.c
    $(CC) $(CFLAGS) threads.c

thread.o: queueImp.c
    $(CC) $(CFLAGS) queueImp.c

clean:
    rm -rf *o threadss

However the following error is returned:

Makefile:8: *** missing separator.  Stop.

Please help me to solve this. I am using the unix environment.

Upvotes: 9

Views: 8569

Answers (1)

Sourav Ghosh
Sourav Ghosh

Reputation: 134336

makefile needs a tab before every command of a rule. Make sure there is a tab [not spaces] before $(CC) thread.o queueImp.o -o threadss and other commands.

Note: Usually, the clean command is used to remove object files having .o extensions. maybe what you want is

 rm -rf *.o threadss
         ^
         |

to serve the actual purpose.

Upvotes: 17

Related Questions