Help with 'exists' in Makefile

Nicola Vitale nivit at email.it
Mon Dec 8 10:32:28 PST 2003


> [Sergey Matveychuk, 2003-12-08T11:29:52+00:00]
> [...]
> Why '.if exists()' always fails?
>
> [...]
> TESTS_COOKIE=	${WRKDIR}/.tests_built
> [...]
> test: build
> .if exists(${TESTS_COOKIE})
> 	@${ECHO_MSG} "===> Running tests."; \
> 	${ECHO_MSG} "===> Tests done."
> .else
> 	@${ECHO_MSG} "===> Tests was not build"; \
> 	${ECHO_MSG} ""
> .endif
> 
> .include <bsd.port.mk>

Because the WRKDIR variable is defined in post-makefile
section, so when your target (test) is built it is null.

Try this:

# touch /.tests_built
# make test

It also works, for example, if you put your target after
the directive

.include <bsd.port.post.mk>

but this usage is forbidden. :)

Ciao.
-- 
Nicola S. Vitale
nivit at email.it


More information about the freebsd-ports mailing list