Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 580
M_Row Avatar asked Mar 16 '15 06:03

M_Row


People also ask

What does missing separator in Makefile mean?

Means that the makefile contains spaces instead of Tab's. The make utility is notoriously picky about the use of Space instead of Tab . So it's likely that the makefile contains Space at the beginning of rule stanzas within the file.


1 Answers

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.

like image 115
Sourav Ghosh Avatar answered Nov 16 '22 10:11

Sourav Ghosh