From owner-freebsd-ports@FreeBSD.ORG Tue Dec 29 08:12:12 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 E7197106568B for ; Tue, 29 Dec 2009 08:12:12 +0000 (UTC) (envelope-from ykrapiva@gmail.com) Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com [209.85.220.227]) by mx1.freebsd.org (Postfix) with ESMTP id 710118FC19 for ; Tue, 29 Dec 2009 08:12:12 +0000 (UTC) Received: by fxm27 with SMTP id 27so10630322fxm.3 for ; Tue, 29 Dec 2009 00:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer; bh=mCl0FgHqKL5rea00dlegDn9PjnUvXgcDW3Eoc7/Jo0M=; b=achb4vqBa44VipAfpO0SS52F6+CZWUogJNnZOAE8vdA+twA53h/uRXj5rMONdTBvR9 FYrNmKlluE1ViZScHlY4oUjhuhB6iXCPdQB6GhseZWsQ2mYgE/AYL/6vSjpxgMATVJ/H 7DOswVLlDN/6t7b3B62mAtQda/tYESl4gacxY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer; b=kJFQiF35f4Re6c1k+2hcDgN7P4TuOBT2GboMvDKux+Zxs38WZJA7/p/5jET8sSA9Wn jhZ/I4ZstOXNAhNEdOrV6cE6fkk8BeOB61UrxIcyD8gfiRlzBZhaxyP2opxKe4m3Wlws OA0SpOKLVS3UsLvt36+48yPYGhvQxzh+4i34I= Received: by 10.223.92.147 with SMTP id r19mr6794722fam.19.1262074328657; Tue, 29 Dec 2009 00:12:08 -0800 (PST) Received: from ?77.52.102.104? ([77.52.102.104]) by mx.google.com with ESMTPS id 9sm18142436fks.22.2009.12.29.00.12.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 29 Dec 2009 00:12:07 -0800 (PST) From: Yevgen Krapiva To: Ulrich =?ISO-8859-1?Q?Sp=F6rlein?= In-Reply-To: <1262073412.6714.7.camel@kv-po-ykrapivanb.umc.com.ua> References: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua> <20091228161104.GB3508@acme.spoerlein.net> <1262073412.6714.7.camel@kv-po-ykrapivanb.umc.com.ua> Date: Tue, 29 Dec 2009 10:11:03 +0200 Message-ID: <1262074263.6714.14.camel@kv-po-ykrapivanb.umc.com.ua> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 FreeBSD GNOME Team Port Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Scot Hetzel , freebsd-ports@freebsd.org, David Wolfskill 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: Tue, 29 Dec 2009 08:12:13 -0000 Thanks to all, Scot Hetzel have found the reason, I had to add the following line before target definitions: .include And yes, tomcat6 Makefile also had this line but I've missed it :( On Tue, 2009-12-29 at 09:56 +0200, Yevgen Krapiva wrote: > 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 > >