[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

executing a rule prior to any targets?

From: gk
Subject: executing a rule prior to any targets?
Date: Fri, 18 Oct 2002 15:44:57 -0700

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
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 \

Greg Keraunen <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]