From owner-freebsd-current@FreeBSD.ORG Thu Aug 25 18:46: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 976E316A562; Thu, 25 Aug 2005 18:46:22 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.93]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3076243D5C; Thu, 25 Aug 2005 18:46:20 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from orion.daedalusnetworks.priv (aris.bedc.ondsl.gr [62.103.39.226]) by aiolos.otenet.gr (8.13.4/8.13.4/Debian-1) with SMTP id j7PIkFSf028797; Thu, 25 Aug 2005 21:46:15 +0300 Received: from orion.daedalusnetworks.priv (orion [127.0.0.1]) by orion.daedalusnetworks.priv (8.13.4/8.13.4) with ESMTP id j7PIkFuW097182; Thu, 25 Aug 2005 21:46:15 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by orion.daedalusnetworks.priv (8.13.4/8.13.4/Submit) id j7PIkEd0097181; Thu, 25 Aug 2005 21:46:14 +0300 (EEST) (envelope-from keramida@freebsd.org) X-Authentication-Warning: orion.daedalusnetworks.priv: keramida set sender to keramida@freebsd.org using -f Date: Thu, 25 Aug 2005 21:46:14 +0300 From: Giorgos Keramidas To: Emanuel Strobl Message-ID: <20050825184614.GA97117@orion.daedalusnetworks.priv> References: <200508251951.37319@harrymail> <35c231bf05082511101884faf@mail.gmail.com> <200508252037.04779@harrymail> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200508252037.04779@harrymail> Cc: freebsd-current@freebsd.org, David Kirchner , 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: Thu, 25 Aug 2005 18:46:22 -0000 On 2005-08-25 20:36, Emanuel Strobl wrote: > Am Donnerstag, 25. August 2005 20:10 CEST schrieb David Kirchner: > > This Makefile shows the problem: > > > > all: > > .if ! exists(./foobar) > > @echo foobar does not exist > > .endif > > touch foobar > > .if ! exists(./foobar) > > @echo foobar does not exist > > .endif > > > > If you run make in this directory, and foobar does not already exist > > beforehand: > > > > $ make > > foobar does not exist > > touch foobar > > foobar does not exist > > > > Looking at the make source, it appears that it maintains a cache for > > file lookups, and I don't see a way to have it flush the hash via some > > makefile command. I dunno if it is a bug but the man page does not > > mention a cache. > > > > I wonder if you'll have to start a separate make process for each > > stage of that target's handling. > > Thanks for your suggestion, you described exactly what I mean. So if > there's no way to flush the cache, it's IMHO a wrong behaviour and > should be considered as bug. I'm not too experienced in make, so I > don't know if I want to call sub makes... Do you have an idea whom to > contact regarding the "bug"? You can call a sub-make with the help of an ``auxiliary'' target: % all: create-file show-file % % create-file: % .if ! exists(./foobar) % @echo foobar does not exist % .endif % touch foobar % % show-file: % @$(MAKE) show-file-aux % % show-file-aux: % .if ! exists(./foobar) % @echo foobar does not exist % .else % @ls -l foobar % .endif This should result in something like this: % orion:/tmp/foobar$ make % foobar does not exist % touch foobar % -rw-rw-r-- 1 keramida wheel 0 Aug 25 21:44 foobar % orion:/tmp/foobar$