Richard Lowe wrote:
Danek Duvall <danek.duv...@sun.com> writes:
James C. McPherson wrote:
The answer is that while most people are using bldenv or nightly with
an appropriate env file, some (including myself) use "ws" or some other
method to set $SRC, $ROOT etc. Having the PRE_POUND etc in Makefile.master
makes sure that those people also see the benefit of the changes. I've
included a comment to this effect in Makefile.master.
And the reason it's still in nightly and bldenv is so that folks who are
using the new nightly and bldenv with older workspaces also benefit from
having POUND_SIGN pre-defined in the environment? Did you confirm that the
shell wasn't called even in that case, like Rich said he thought it might?
It's actually James that pointed that out to me, From make(1S):
Next, make imports variables from the environment (unless
the -e option is in effect), and treats them as defined mac-
ros. Because make uses the most recent definition it
encounters, a macro definition in the makefile normally
overrides an environment variable of the same name. When -e
is in effect, however, environment variables are read in
after all makefiles have been read. In that case, the
environment variables take precedence over definitions in
the makefile.
A Makefile of the form:
POUND_SIGN:sh= echo \\043 && touch /tmp/foo
all:
@echo POUND_SIGN "$(POUND_SIGN)"
Will create /tmp/foo in every case:
dmake
dmake -e
POUND_SIGN="#" dmake
POUND_SIGN="#" dmake -e
It's quite possible I'm being absolutely dense, but their presence in
bldenv and nightly appears to me to do absolutely nothing of value.
I concur with Rich.
Setting POUND_SIGN in the environment does not prevent evaluation
of the rule
POUND_SIGN:sh= echo \\043 && touch /tmp/foo
viz:
ns-t2000-17:poundsigntest $ cat Makefile
POUND_SIGN:sh= echo \\043 && touch /tmp/poundsigntest/foo
all:
-...@ls -al /tmp/poundsigntest/foo
@echo POUND_SIGN "$(POUND_SIGN)"
-...@rm /tmp/poundsigntest/foo
ns-t2000-17:poundsigntest $ echo $POUND_SIGN
#
ns-t2000-17:poundsigntest $ make ; make -e; dmake ; dmake -e
-rw-r--r-- 1 jmcp staff 0 Sep 24 17:01 /tmp/poundsigntest/foo
POUND_SIGN #
-rw-r--r-- 1 jmcp staff 0 Sep 24 17:01 /tmp/poundsigntest/foo
POUND_SIGN #
dmake: defaulting to parallel mode.
See the man page dmake(1) for more information on setting up the .dmakerc file.
ns-t2000-17 --> 1 job
ns-t2000-17 --> Job output
-rw-r--r-- 1 jmcp staff 0 Sep 24 17:01 /tmp/poundsigntest/foo
POUND_SIGN #
dmake: defaulting to parallel mode.
See the man page dmake(1) for more information on setting up the .dmakerc file.
ns-t2000-17 --> 1 job
ns-t2000-17 --> Job output
-rw-r--r-- 1 jmcp staff 0 Sep 24 17:01 /tmp/poundsigntest/foo
POUND_SIGN #
ns-t2000-17:poundsigntest $
However, setting the rule to
$(POUND_SIGN)POUND_SIGN:sh= echo \\043 && touch /tmp/poundsigntest/foo
does make a difference:
ns-t2000-17:poundsigntest $ export POUND_SIGN="#"
ns-t2000-17:poundsigntest $ !ma
make ; make -e; dmake ; dmake -e
/tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
ls -al /tmp/poundsigntest/foo
POUND_SIGN #
rm: /tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
rm /tmp/poundsigntest/foo
/tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
ls -al /tmp/poundsigntest/foo
POUND_SIGN #
rm: /tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
rm /tmp/poundsigntest/foo
dmake: defaulting to parallel mode.
See the man page dmake(1) for more information on setting up the .dmakerc file.
ns-t2000-17 --> 1 job
ns-t2000-17 --> Job output
/tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
ls -al /tmp/poundsigntest/foo
POUND_SIGN #
rm: /tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
rm /tmp/poundsigntest/foo
dmake: defaulting to parallel mode.
See the man page dmake(1) for more information on setting up the .dmakerc file.
ns-t2000-17 --> 1 job
ns-t2000-17 --> Job output
/tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
ls -al /tmp/poundsigntest/foo
POUND_SIGN #
rm: /tmp/poundsigntest/foo: No such file or directory
*** Error code 2 (ignored)
The following command caused the error:
rm /tmp/poundsigntest/foo
ns-t2000-17:poundsigntest $
Since the point of the exercise is to avoid a subshell invocation,
I think it much better to use the suggested fix form of
PRE_POUND= pre\#
POUND_SIGN= $(PRE_POUND:pre\%=%)
People using the new nightly / bldenv with an old $SRC/Makefile.master
will not see any change to their build times.
James
_______________________________________________
tools-discuss mailing list
tools-discuss@opensolaris.org