I have a makefile, where i am exporting variables which will be received by an executable, but surprisingly the executable is not receiving the exported values.
Please help me.
31 test:
32 @ echo
33 @ echo "Testing Electric Fence."
34 @ echo "After the last test, it should print that the test has PASSED."
35 ./eftest
36 ./tstheap 3072
37 export EF_ERRTRACK_START=3
38 export EF_ERRTRACK_END=5
39 ./time-interval-measurement-test
40 @ echo
41 @ echo "Electric Fence confidence test PASSED."
42 @ echo
time-interval-measurement-test
is an executable (C program) which should receive the exported variables, but it is not getting. Please help me.
If I'm not mistaken each line in a Makefile is a separate shell-process. So shell-export does not work for several processes: One way to do it is to put them into one line:
test:
@ echo
@ echo "Testing Electric Fence."
@ echo "After the last test, it should print that the test has PASSED."
./eftest
./tstheap 3072
EF_ERRTRACK_START=3 EF_ERRTRACK_END=5 ./time-interval-measurement-test
@ echo
@ echo "Electric Fence confidence test PASSED."
@ echo
or line-break-escaped with '\'
test:
[..]
EF_ERRTRACK_START=3 \
EF_ERRTRACK_END=5 \
./time-interval-measurement-test
Like that the ENV-variables are available to ./time-interval-measrument
I had asked for a similar question, but its not the exact same scenario how to implement makefile shared variable
Ideally your exported variables should have passed on to the child process, I wonder if your child shell is same as parent.
Try following - export EF_ERRTRACK_START=3; export EF_ERRTRACK_END=5; ./time-interval-measurement-test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With