How to call a script in Makefile and capture its output?

Hello All,

Inside my makefile I would like to execute a separate script and capture its output.

I thought this would work.

VARIABLE:sh= script_to_be_called

SECONDVAR = $(VARIABLE)

But it is not working, any ideas?

Thanks!

^bump ^^^^

What is it you want to do with the output?

Hey Ken,

Store the output into the VARIABLE.

Thanks!

And what do you want to do with the variable?

Here is a silly example that might be of use


VARIABLE:="ls"
SECONDVAR:=$(shell $(VARIABLE))

all:
        @echo "VARIABLE=$(VARIABLE)"
        @echo "SECONDVAR=$(SECONDVAR)"

Output is


~/tmp> make
VARIABLE=ls
SECONDVAR=Makefile test test.c

Thanks cpack! It worked.

I just had to use full path for my VARIABLE; since, it was a non OS script I need to call.

SCRIPT:=/full_path/*script
FUNCTION:=$(shell $(SCRIPT))

Thank you!