From owner-freebsd-current@FreeBSD.ORG Fri Aug 26 05:55:22 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BCAF716A42A; Fri, 26 Aug 2005 05:55:22 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.village.org (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1EE7843D45; Fri, 26 Aug 2005 05:55:22 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1]) by harmony.village.org (8.13.3/8.13.3) with ESMTP id j7Q5qk8I094686; Thu, 25 Aug 2005 23:52:47 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 25 Aug 2005 23:53:03 -0600 (MDT) Message-Id: <20050825.235303.66274316.imp@bsdimp.com> To: keramida@freebsd.org From: "M. Warner Losh" In-Reply-To: <20050825184614.GA97117@orion.daedalusnetworks.priv> References: <35c231bf05082511101884faf@mail.gmail.com> <200508252037.04779@harrymail> <20050825184614.GA97117@orion.daedalusnetworks.priv> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.village.org [127.0.0.1]); Thu, 25 Aug 2005 23:52:52 -0600 (MDT) Cc: Emanuel.strobl@gmx.net, freebsd-current@freebsd.org, dpk@dpk.net, freebsd-questions@freebsd.org Subject: Re: make ".if exists" problem/question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2005 05:55:22 -0000 Yes. The thing to keep in mind is that much of the .if stuff is done at parsing or rule construction time. So if you change something (creating a file, say), then that condition won't be re-evaluated. For the specific example given, one could replace much of the goo with: target: foobar foobar: touch foobar if you wanted to create foobar. Otherwise, I'd be tempted not to use .if exists. I'd be tempted to do something more like: target: @-if [ -f foobar ]; then cat foobar; else touch foobar; fi where you have the shell check. The primary use of exists() I've seen is: .if exists(foo.mk) .include "foo.mk" .endif although I have seen others. Warner