Date: Mon, 28 Dec 2009 17:11:05 +0100 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= <uqs@spoerlein.net> To: Yevgen Krapiva <ykrapiva@gmail.com> Cc: freebsd-ports@freebsd.org Subject: Re: Strange behavior of 'exists' function. Need help with Makefile. Message-ID: <20091228161104.GB3508@acme.spoerlein.net> In-Reply-To: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua> References: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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?20091228161104.GB3508>