How to assign a variable the output of a shell command in Tupfile?

224 views Asked by At

I'd like to assign a variable in a Tupfile the output of the command find . -name "*.cpp" -exec dirname {} \; | sort -u. How can I do it?

2

There are 2 answers

2
Galik On BEST ANSWER

This works for me:

BOTAN_CFLAGS = `pkg-config botan-1.10 --cflags`

NOTE: the back-tick character "`"

However this only seems to work in the command section of the rules not the dependencies.

0
Noam Cohen On

From what I read in the manual, the variable assignment does not cause the shell command to be executed. Instead, it is stored as regular string. Then when the variable is passed to a command, the shell expands it. It means that if you have K files to compile, the shell expression will be evaluated K times.