Jorge Espinoza
Jorge Espinoza

Reputation: 107

Makefile:1: *** missing separator. (I use tab, not spaces)

I know this question have been asked a lot of times, but I can't fix my error anyway.

I'm doing a Makefile with this content:

if [ -d "$HOME/.local/share/nvim/site/autoload/" ]; then
        mkdir -p $HOME/.local/share/nvim/site/autoload/ 
fi

When I run it, I get

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

In order to check if the script has spaces instead of tab, I type on the prompt

cat -t Makefile

so I get

if [ -d "$HOME/.local/share/nvim/site/autoload/" ]; then
^Imkdir -p $HOME/.local/share/nvim/site/autoload/
fi

What's the problem?

Upvotes: 1

Views: 133

Answers (1)

Doj
Doj

Reputation: 1311

GNU make is not bash, it has its own syntax. Your code would be like this:

ifeq ($(wildcard $(HOME)/.local/share/nvim/site/autoload/),)
  MKDIR_OUTPUT:=$(shell mkdir -p $(HOME)/.local/share/nvim/site/autoload/)
endif

No tabs needed here since it is not a recipe.

Upvotes: 2

Related Questions