Jacob Hempel
Jacob Hempel

Reputation: 37

Trying to remove prefix, getting "make: missing separator"

Trying to remove a file prefix using the method proposed in this thread:

Remove prefix with make

but even with a copy paste, I'm getting make's missing separator error.

FILE=/a/thing    #line 16
$(FILE:a/%=%)    #line 17

Makefile:17: *** missing separator.    Stop.

Upvotes: 2

Views: 1142

Answers (1)

jfMR
jfMR

Reputation: 24778

When GNU Make processes the following:

FILE=a/thing
$(FILE:a/%=%)

The $(FILE:a/%=%) is evaluated to thing. That's the problem.


What you want is probably:

removed-prefix=$(FILE:a/%=%)

That is, create a variable removed-prefix whose expansion results in thing, or:

FILE:=$(FILE:a/%=%)

Upvotes: 1

Related Questions