For example, my root Makefile is at ~/, and I called a sub-Makefile at: ~/subdir/Makefile. How can I export environment variables from the sub-Makefile globally, to the current executing shell of my root Makefile?
For example, my root Makefile is at ~/ , and I called a sub-Makefile
Share
As geekosaur noted, you can’t do it directly; a child process cannot modify the environment of a parent process.
What you might be able to do is have the parent makefile include a file from the sub-directory which the makefile in the sub-directory also uses, and those settings are then, effectively, in the parent makefile.
You can’t get make to export variables to your current shell at all; you’d have to have make run an interactive shell for you with the environment variables set — but that would be a very weird way of doing business.