excellent. thank you. On Fri, 2007-08-03 at 16:14 -0600, Philip Guenther wrote: > On 8/3/07, cbrown <[EMAIL PROTECTED]> wrote: > ... > > $(PROJECTS): > > ifeq ($(MAKECMDGOALS),clean) > > @echo "($@,$(CURR))" > > ifeq ($@,$(CURR)) > > @echo gonna clean $@ > > else > > @echo NOT gonna clean $@ > > endif > > else > > @echo gonna $(MAKECMDGOALS) $@ > > endif > > > > When I execute "make CURR=a clean", I get; > > > > (b,a) > > NOT gonna clean b > > (a,a) > > NOT gonna clean a > > > > How come the "ifeq ($@,$(CURR))" doesn't work? > > Because make's conditionals are evaluated during the parse of the > makefile, while target-specific variables like $@ are only set during > the evaluation of the target's rules. > > > > Is there an easier path to my goal? > > Yes: use a shell conditional for the test of $@: > > $(PROJECTS): > ifeq ($(MAKECMDGOALS),clean) > @echo "($@,$(CURR))" > @if [ x"$@" = x"$(CURR)" ]; then \ > echo gonna clean $@; \ > else \ > echo NOT gonna clean $@; \ > fi > else > @echo gonna $(MAKECMDGOALS) $@ > endif > > > Note the placement of semicolons and backslashes and that the leading > '@' is only on the first line of the multi-line command. > > > Philip Guenther
_______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
