1

Makefile:

$(shell ./test.sh)

1st experiment: test.sh

echo "hi"

Error I get:

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

2nd experiment: test.sh

echo("hi")

Errors I get:

./test.sh: line 1: syntax error near unexpected token `"hi"' 
./test.sh: line 1: `echo("hi")'

Doesn't make any sense...it looks as if 'Make' tries to impose its syntax on the shell script, but the shell script wants its own too.

1 Answer 1

6

try ./test.sh.

In the first experiment, the result is

hi

When you run make, the line $(shell ./test.sh) evaluates as hi, which Make doesn't know how to interpret.

In the second experiment,

./test.sh: line 1: syntax error near unexpected token `"hi"'
./test.sh: line 1: `echo("hi")'

You've written a shell script that doesn't have correct shell syntax, so it fails. It fails whether you run it or Make runs it.

Sign up to request clarification or add additional context in comments.

8 Comments

I tried that, but it says: "Makefile:1: *** missing separator. Stop." aswell. I don't know what to make of this..
Oh damn, apparently I can't just put that line anywhere, it has to be a recipe. Thanks for your help!
Not exactly, you can use $(warning $(shell ... )), warning is guaranteed to produce null output, then you can use (fake) assignment AAA := $(shell ...) - that all depends on your particular needs.
@pmod: true, and you can also use $(info $(shell ...)), like warning but less urgent.
@Blub Makefile:1: *** missing separator usually means you have spaces instead of tabs. Makefile only likes tabs
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.