This is a follow up on this question: Can I use GNU make's SHELL variable to connect to a remote shell?
I'd like to use two different shells in a single recipe. One shell is on a host machine, and the other is on a target device that doesn't have make. The shell on the host machine is used for tracking tests' success and failure. The shell on the target device is used for performing the test. I've successfully used $(eval SHELL=) to change from the host shell to the target shell. However, when I add $(eval SHELL=) to the recipe, it seems like the SHELL never changes. I assume that the two eval functions are evaluated before the recipe is run, so the second expansion cancels the first one out. Is there a way to make these eval functions expand during run time, or otherwise change the SHELL variable twice in a single recipe?
To illustrate what I'm aiming at, it will be something like this:
test: test_dependencies
touch $host_files_for_tracking
SHELL = target_shell
$(program_to_test) $(params) -o result
cmp result gold
SHELL = host_shell
rm $host_files_for_tracking
Thanks.
Note: When I'm talking about SHELL, I'm referring to the make-internal variable that determines which shell make invokes in order to executes recipe steps, not the environment variable.