I am trying to set an Environment variable in a Makefile, so it can be used in another program running in the sam shell as make, but after make ha
Your export TEST_ENV_ONE=OneString above is running in a dedicated shell. The subsequent commands run in other shell instances. Therefore, they don't inherit the environment variable TEST_ENV_ONE.
You could use a top-level (i.e., not in a target's recipe) export directive in the makefile:
export env_var := MyEnvVariable
.PHONY: all
all:
echo env_var: $$env_var
This way, the variable env_var is exported to the shells that will execute the recipes.
If you run make with the makefile above:
$ make
echo env_var: $env_var
env_var: MyEnvVariable
As you can see from the output, the shell that run echo env_var: $env_var had the variable env_var in its environment.