Re: User defined function

Tim Murphy <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <CACJSg6n6QtTyS4GoyMNz1AtRdZ_xFvjePWiR0QOSGSeiorV-cA@mail.gmail.com>
The makefile is parsed and expressions outside of the targets rules are
expanded, then when a target is chosen to be built, it's rule is expanded.

You're creating a shell variable hello but trying to use a make variable
$hello before this shell variable has been assigned.

you end up with
all:
<tab>hello=1    #this will create a bash variable hello in the scope of
this single line of shell code - no effect on the next line
<tab>               # nothing here because before this all got executed the
before ifeq was expanded.


So if I change it, I can make it "work"

define check_defined
$(1)=1
endef
$(eval $(call check_defined,hello))
all:
ifeq ($(hello),1)
<tab>sleep 10
endif

Cheers,

Tim

define check_defined
>     @$(1)=1;
> endefall:
>     $(call check_defined, hello)
> ifeq ($(hello),1)
>     sleep 10
> endif
>
> I am expecting, when I invoke "make all" it should sleep for 10 secs but it
> is not happening, what is wrong with it and how can I achieve it?
>
> Thanks,
> -Rajeev
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.