Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile:1: *** missing separator. Stop

Tags:

c

makefile

I'm creating a project on c and when i make my Makefile and try to run it it gives me this error:

Makefile:1: *** missing separator.  Stop. 

My makefile code is:

CC=gcc OBJ=./objetos INC=./include FON=./aqsFonte BIB=./bibliotecas OPBIB=-lBiblioteca ProjetoFinal: libFinal.a      $(CP) $(FON)/ProjetoFinal.c -I$(INC) -L$(BIB) $(OPBIB) -o ProjetoFinal  Bibliotecas.a: Caminho.o Libs_Defines.o Matrizes.o Proc_Imagens.o Vetores.o     ar -q $(BIB)/libFinal.a Caminho.o ibs_Defines.o Matrizes.o Proc_Imagens.o Vetores.o  Caminho.o:     $(CP) $(FON)/Caminho.c -o Caminho.o Libs_Defines.o :     $(CP) $(FON)/Libs_Defines.c -o Libs_Defines.o Matrizes.o:     $(CP) $(FON)/Matrizes.c -o Matrizes.o Proc_Imagens.o:      $(CP) $(FON)/Proc_Imagens.c -o Proc_Imagens.o Vetores.o:     $(CP) $(FON)/Vetores.c -o Vetores.o 

Also, it's all tabbed correctly I guess.

like image 801
João Miranda Avatar asked Sep 21 '13 18:09

João Miranda


People also ask

What does missing separator in makefile?

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.

Are tabs or spaces used to indent the commands after the rule in a makefile?

Recipes in makefile rules must start with a tab (per definition). If a single tab (interpreted as 8 spaces wide) is not enough to put the recipe clearly indented (meaning at least 4 spaces difference) from the code around it, use additional tabs.


2 Answers

It's a tabs problem. Some text editors may replace tabs with white spaces, make sure you use a proper text editor that doesn't mess it up. Open your makefile in vi or any other rudimentary editor, and rewrite that makefile.

Note that after each target rule, one single tab must be placed in the beginning of the line. Everything that comes after that tab is passed on to the shell (there can be more tabs, spaces, and whatever you want, but keep in mind that there must be a tab in the beginning of the line).

like image 200
Filipe Gonçalves Avatar answered Oct 12 '22 01:10

Filipe Gonçalves


can you try running -

perl -pi -e 's/^  */\t/' Makefile 

(after saving a backup of course)

like image 31
Leeor Avatar answered Oct 12 '22 02:10

Leeor