From owner-freebsd-ports@FreeBSD.ORG Mon Dec 28 16:11:07 2009 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C944D106566B for ; Mon, 28 Dec 2009 16:11:07 +0000 (UTC) (envelope-from uqs@spoerlein.net) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:198:206::1]) by mx1.freebsd.org (Postfix) with ESMTP id 38A4F8FC19 for ; Mon, 28 Dec 2009 16:11:07 +0000 (UTC) Received: from acme.spoerlein.net (localhost.spoerlein.net [IPv6:::1]) by acme.spoerlein.net (8.14.3/8.14.3) with ESMTP id nBSGB54c008659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Dec 2009 17:11:05 +0100 (CET) (envelope-from uqs@spoerlein.net) Received: (from uqs@localhost) by acme.spoerlein.net (8.14.3/8.14.3/Submit) id nBSGB5sl008658; Mon, 28 Dec 2009 17:11:05 +0100 (CET) (envelope-from uqs@spoerlein.net) Date: Mon, 28 Dec 2009 17:11:05 +0100 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: Yevgen Krapiva Message-ID: <20091228161104.GB3508@acme.spoerlein.net> Mail-Followup-To: Yevgen Krapiva , freebsd-ports@freebsd.org References: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-ports@freebsd.org Subject: Re: Strange behavior of 'exists' function. Need help with Makefile. X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 16:11:07 -0000 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