I want to compile a program which includes a define -D. The define is not fixed, but is the output of another program genRandom. In other words, the genRandom program outputs a random 10 characters string. I want to use that to be a define of the first program. I am using Linux with Bash as shell. In effect I want something like:
gcc main.c -DVAL=<output of genRandom>
The end result is the define is randomly generated at compile time.
The bash syntax for incorporating the output of a command into a command line is `command`
or $(command)
. So gcc main.c -DVAL=$(genRandom)
would do what you ask.