Yes.  The thing to keep in mind is that much of the .if stuff is done
at parsing or rule construction time.  So if you change something
(creating a file, say), then that condition won't be re-evaluated.

For the specific example given, one could replace much of the goo
with:

target: foobar

foobar:
        touch foobar

if you wanted to create foobar.  Otherwise, I'd be tempted not to use
.if exists.  I'd be tempted to do something more like:

target:
        @-if [ -f foobar ]; then cat foobar; else touch foobar; fi

where you have the shell check.

The primary use of exists() I've seen is:

.if exists(foo.mk)
.include "foo.mk"
.endif

although I have seen others.

Warner
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to