Date: Tue, 29 Dec 2009 09:56:52 +0200 From: Yevgen Krapiva <ykrapiva@gmail.com> To: Ulrich =?ISO-8859-1?Q?Sp=F6rlein?= <uqs@spoerlein.net> Cc: freebsd-ports@freebsd.org, David Wolfskill <david@catwhisker.org> Subject: Re: Strange behavior of 'exists' function. Need help with Makefile. Message-ID: <1262073412.6714.7.camel@kv-po-ykrapivanb.umc.com.ua> In-Reply-To: <20091228161104.GB3508@acme.spoerlein.net> References: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua> <20091228161104.GB3508@acme.spoerlein.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks Ulrich, I've discovered the following issue: !!! This example works: !!! MY_FILE= /usr/local/share/openjsip/conf/proxy.properties do-check: .for f in ${MY_FILE} . if !exists(${f}) @${ECHO_MSG} ">> File ${f} doesn't exists" . else @${ECHO_MSG} ">> File ${f} exists" . endif .endfor !!! And this one doesn't: !!! MY_FILE= proxy.properties do-check: .for f in ${MY_FILE} . if !exists(${DATADIR}/conf/${f}) @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} doesn't exists" . else @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} exists" . endif .endfor So, I will use the first method... But anyway I would like to know why the second example doesn't work. P.S. The second example was copied from tomcat6 port :\ On Mon, 2009-12-28 at 17:11 +0100, Ulrich Spörlein wrote: > On Mon, 28.12.2009 at 10:13:42 +0200, Yevgen Krapiva wrote: > > Hi guys, > > > > I'm trying to create my own port. I'm stucked with the following > > Makefile: > > > > PORTNAME= openjsip > > PORTVERSION= 0.0.4 > > ... > > ... > > MY_FILE= proxy.properties > > > > do-check: > > > > #FIRST TEST > > . if !exists(/usr/local/share/openjsip/conf/proxy.properties) > > @${ECHO_MSG} ">> /usr/local/share/openjsip/conf/proxy.properties > > doesn't exist" > > . else > > @${ECHO_MSG} ">> /usr/local/share/openjsip/conf/proxy.properties > > exists" > > . endif > > > > #SECOND TEST > > @${ECHO_MSG} ">> DATADIR=${DATADIR}" > > > > .for f in ${MY_FILE} > > . if !exists(${DATADIR}/conf/${f}) > > @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} doesn't exist" > > . else > > @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} exists" > > . endif > > .endfor > > > > > > I'm trying to make script to check the existence of proxy.properties > > file. > > The first test works well while to other one (with the use of 'for') > > doesn't. > > Can you help me, I don't understand why the second test fails. > > First of all, please do not use "empty" lines inside a Makefile, it is > not an imperative language and care must be taken so that the parser > gets things right. > > Doing a minimal test, I cannot confirm your findings, perhaps you should > try to trim down your example and see where it breaks or starts to work. > > Example: > > FILES=/etc/rc.conf /etc/doener.conf > > all: > .for f in ${FILES} > .if !exists(${f}) > @echo "${f} does not exist" > .else > @echo "${f} does exist" > .endif > .endfor > > % make all > /etc/rc.conf does exist > /etc/doener.conf does not exist > > hth, > Uli >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1262073412.6714.7.camel>