[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
variables defined in the makefile are ...
From: |
積丹尼 Dan Jacobson |
Subject: |
variables defined in the makefile are ... |
Date: |
Mon, 04 Jan 2016 08:07:37 +0800 |
(info "(make) Environment") says
When 'make' runs a recipe, variables defined in the makefile are
placed into the environment of each shell.
Not true.
KK = 22
p:
env|grep -c KK
gives 0!
This allows you to pass
values to sub-'make' invocations (*note Recursive Use of 'make':
Recursion.). By default, only variables that came from the environment
or the command line are passed to recursive invocations.
So then above say "SOME CERTAIN variables defined in the makefile..."
You can use
the 'export' directive to pass other variables. *Note Communicating
Variables to a Sub-'make': Variables/Recursion, for full details.
Oh. Only now do you reveal which ones.
P.S., please link 'export'.
P.P.S
BROWSER=bla
TROWSER=bla
p:
env|grep ROWSER
gives
BROWSER=bla
SO OK, the top paragraph also has problems,
Variables in 'make' can come from the environment in which 'make' is
run. Every environment variable that 'make' sees when it starts up is
transformed into a 'make' variable with the same name and value.
However, an explicit assignment in the makefile OF AN ALREADY
EXISTING ENVIRONMENT VARIABLE, OR A NEW ENVIRONMENT VARIABLE IN
THE MAKEFILE MARKED WITH THE 'EXPORT' COMMAND or with a command
argument, overrides the environment. (If the '-e' flag is specified,
then values from the environment override assignments in the makefile.
*Note Summary of Options: Options Summary. But this is not recommended
practice.)
All in all I would make an entire new paragraph showing how all these
are born...
Also mention the only way to append things to PATH from within the makefile,
PATH=$$PATH:../v4
PATH=$(PATH):../v4
PATH=/home/jidanni/bin:/usr/bin:/bin:../v4
PATH+=:../v4
Is to use the third version,
as the first will cause "ATH",
the second a recursive error,
and the fourth a blank in PATH that will cause any pipes commands to burst...
Test with
p:
echo $$PATH
env #|grep PATH
env |grep PATH
- variables defined in the makefile are ...,
積丹尼 Dan Jacobson <=