Make error: missing separator

Makefile

Makefile Problem Overview


I am getting the following error running make:

Makefile:168: *** missing separator.  Stop.

What is causing this?

Makefile Solutions


Solution 1 - Makefile

As indicated in the online manual, the most common cause for that error is that lines are indented with spaces when make expects tab characters.

Correct

target: 
\tcmd

where \t is TAB (U+0009)

Wrong

target:
....cmd

where each . represents a SPACE (U+0020).

Solution 2 - Makefile

Just for grins, and in case somebody else runs into a similar error:

I got the infamous "missing separator" error because I had invoked a rule defining a function as

($eval $(call function,args))

rather than

$(eval $(call function,args))

i.e. ($ rather than $(.

Solution 3 - Makefile

This is a syntax error in your Makefile. It's quite hard to be more specific than that, without seeing the file itself, or relevant portion(s) thereof.

Solution 4 - Makefile

For me, the problem was that I had some end-of-line # ... comments embedded within a define ... endef multi-line variable definition. Removing the comments made the problem go away.

Solution 5 - Makefile

My error was on a variable declaration line with a multi-line extension. I have a trailing space after the "" which made that an invalid line continuation.

MY_VAR = \
   val1 \ <-- 0x20 there caused the error.
   val2

Solution 6 - Makefile

In my case error caused next. I've tried to execute commands globally i.e outside of any target.

UPD. To run command globally one must be properly formed. For example command

ln -sf ../../user/curl/$SRC_NAME ./$SRC_NAME

would become:

$(shell ln -sf ../../user/curl/$(SRC_NAME) ./$(SRC_NAME))

Solution 7 - Makefile

In my case, I was actually missing a tab in between ifeq and the command on the next line. No spaces were there to begin with.

ifeq ($(wildcard $DIR_FILE), )
cd $FOLDER; cp -f $DIR_FILE.tpl $DIR_FILE.xs;
endif

Should have been:

ifeq ($(wildcard $DIR_FILE), )
<tab>cd $FOLDER; cp -f $DIR_FILE.tpl $DIR_FILE.xs;
endif

Note the <tab> is an actual tab character

Solution 8 - Makefile

In my case, this error was caused by the lack of a mere space. I had this if block in my makefile:

if($(METHOD),opt)
CFLAGS=
endif

which should have been:

if ($(METHOD),opt)
CFLAGS=
endif

with a space after if.

Solution 9 - Makefile

In my case, the same error was caused because colon: was missing at end as in staging.deploy:. So note that it can be easy syntax mistake.

Solution 10 - Makefile

I had the missing separator file in Makefiles generated by qmake. I was porting Qt code to a different platform. I didn't have QMAKESPEC nor MAKE set. Here's the link I found the answer:

https://forum.qt.io/topic/3783/missing-separator-error-in-makefile/5

Solution 11 - Makefile

Just to add yet another reason this can show up:

$(eval VALUE)

is not valid and will produce a "missing separator" error.

$(eval IDENTIFIER=VALUE)

is acceptable. This sort of error showed up for me when I had an macro defined with define and tried to do

define SOME_MACRO
... some expression ...
endef

VAR=$(eval $(call SOME_MACRO,arg))

where the macro did not evaluate to an assignment.

Solution 12 - Makefile

I had this because I had no colon after PHONY

Not this,

.PHONY install
install:
    install -m0755 bin/ytdl-clean /usr/local/bin

But this (notice the colon)

.PHONY: install
...

Solution 13 - Makefile

Following Makefile code worked:

obj-m = hello.o

all:
	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules 

clean:
	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

Solution 14 - Makefile

So apparently, all I needed was the "build-essential" package, then to run autoconf first, which made the Makefile.pre.in, then the ./configure then the make which works perfectly...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRenjith GView Question on Stackoverflow
Solution 1 - MakefiledfaView Answer on Stackoverflow
Solution 2 - MakefileKrazy GlewView Answer on Stackoverflow
Solution 3 - MakefileunwindView Answer on Stackoverflow
Solution 4 - MakefileHuguesView Answer on Stackoverflow
Solution 5 - MakefileJHarveyJrView Answer on Stackoverflow
Solution 6 - MakefileyuliskovView Answer on Stackoverflow
Solution 7 - MakefileNenaView Answer on Stackoverflow
Solution 8 - MakefileHashimotoView Answer on Stackoverflow
Solution 9 - MakefilePratikView Answer on Stackoverflow
Solution 10 - MakefileJulieCView Answer on Stackoverflow
Solution 11 - MakefileSimon RoseView Answer on Stackoverflow
Solution 12 - MakefileEvan CarrollView Answer on Stackoverflow
Solution 13 - MakefileJaishree AlavandarView Answer on Stackoverflow
Solution 14 - MakefileKl3m MichardView Answer on Stackoverflow