Setting system-wide environment in Makefile
Is there some platform-independent way to setup a system-wide environment from the Makefile? Specifically, I need to add a path to the CLASSPATH variable during install, to have other programs see the installed jars.
I know that sometimes I can put script into /etc/profile.d/, or modify /etc/envi开发者_JS百科ronment or perhaps use setx.exe on Windows (which needs to be installed, and this is not good).
I'm thinking about some shtool-style solution.
Thank you!In GNU make, just set the variable in the makefile, and then export
it.
export ENV_VAR += some/more/stuff
See Communicating Variables to a Sub-make for precise details of export
.
(I suspect though you may be asking whether to use forward-slashes and colons, or back-slashes and semi-colons in your path definition. That's another question(answer).)
精彩评论