I am trying to write a Makefile that will automatically execute a rule when an environmental variable is set, regardless of any goals/targets to be built.

I seem to be having trouble with $(if ) function since the following makefile generates error.
It appears that $(if ) does not allow semi-colon inside $(shell ) function?
There is no problem with my rule since 'make recurse' works when the $(if ) function is removed.

I would appreciate a better solution or anything that works.

--- From command shell I execute:
$export RECURSE=1
$make
Makefile:3: *** unterminated call to function 'if': missing ')'. Stop.

--- Here is my makefile:
.PHONY: recurse foo

$(if $(RECURSE), $(shell RECURSE=; $(MAKE) recurse ) )

foo : ;

recurse :
@echo recursing...;\
for subdirectory in "1 2 3"; do \
echo $$subdirectory;\
done \

----
Thanks,
Greg Keraunen <[EMAIL PROTECTED]>



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to