That is i want to call given PHONY target depending on the condition,
weather it is true or false.
eg:
I want to check for an environment variable weather, if it is defined
then PHONY target should be executed, else it should echo message that
Environment variable is not defined.
Plz do help -- its urgent
Isn't this a make question, rather than gcc?
Firstly, the target is .PHONY, not PHONY. The purpose of .PHONY is to
have 'targets' that don't exist (like clean, clobber or all).
If I understand rightly, you'd like to make the default target based on
an environment (or command line) argument. So instead of typing
make foo
you'd have
FOO=make in the environement and
make
would make foo.
In this case, something like this might do the trick
ifndef FOO
$(error FOO not defined)
else
# check that $(FOO) matches one of bar, baz ... targets
endif
.PHONY: all
all: $(FOO)
bar:
@echo bar
baz:
@echo baz
A bientot
Paul