From owner-freebsd-ports@FreeBSD.ORG Tue Dec 29 07:58:09 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 3A6FF1065676 for ; Tue, 29 Dec 2009 07:58:09 +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 B9A5E8FC08 for ; Tue, 29 Dec 2009 07:58:08 +0000 (UTC) Received: by fxm27 with SMTP id 27so10624215fxm.3 for ; Mon, 28 Dec 2009 23:57:59 -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=09EPuWyT/pdtNoIcIa9kEOpd6VjrdulKwpQMARdzGe4=; b=uNAUVY4mmUdkRgHnHD9wRk02YtcRA2X8+fUepaw9HsJ6cCGN4focN4GN20PFZ/l4YQ KngeKfjOUUhWDjyf6UYJBbnMrmzAF98BvIS8DZFZtxgyYg0lcp4jgB61QNP8hxZUpTda 64QtfLPM4TH+tdTTYH4wHJO7AbI0K+IxcSUWM= 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=mBAj/ONp8wfVxyCkYSOeYRACyHRIGnB8z+3YTOIP7T93rIWMKvXbfORuxVOjyimWAQ 5i20aVYdp1U5YBlm7mbww+ev3Wn9Y6XvL8oPn/4HThvfzlnQcbWHSZcIdjkkFltD7HtJ ZhlXoXGJjrPGBTotGMK97SpC277SGZQluv7lY= Received: by 10.223.143.73 with SMTP id t9mr11835000fau.89.1262073477731; Mon, 28 Dec 2009 23:57:57 -0800 (PST) Received: from ?77.52.102.104? ([77.52.102.104]) by mx.google.com with ESMTPS id b17sm18003699fka.16.2009.12.28.23.57.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Dec 2009 23:57:56 -0800 (PST) From: Yevgen Krapiva To: Ulrich =?ISO-8859-1?Q?Sp=F6rlein?= In-Reply-To: <20091228161104.GB3508@acme.spoerlein.net> References: <1261988022.9116.14.camel@kv-po-ykrapivanb.umc.com.ua> <20091228161104.GB3508@acme.spoerlein.net> Date: Tue, 29 Dec 2009 09:56:52 +0200 Message-ID: <1262073412.6714.7.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: 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 07:58:09 -0000 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 >