From owner-freebsd-questions@FreeBSD.ORG Tue May 25 23:48:33 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EDAC716A4CE for ; Tue, 25 May 2004 23:48:33 -0700 (PDT) Received: from mail.mri.ernet.in (mail.mri.ernet.in [202.41.87.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1C1C43D3F for ; Tue, 25 May 2004 23:48:27 -0700 (PDT) (envelope-from raghu@mri.ernet.in) Received: from ipc2.mri.ernet.in (unknown [192.168.1.9]) by mail.mri.ernet.in (Postfix) with ESMTP id 31220852B0; Wed, 26 May 2004 17:26:48 +0500 (MVT) Received: from riemann.mri.ernet.in (riemann.mri.ernet.in [192.168.3.122]) by ipc2.mri.ernet.in (Postfix) with ESMTP id 89B332618A; Wed, 26 May 2004 12:20:44 +0530 (IST) Received: from riemann.mri.ernet.in (localhost.mri.ernet.in [127.0.0.1]) i4Q6k28D017899; Wed, 26 May 2004 12:16:02 +0530 (IST) (envelope-from raghu@riemann.mri.ernet.in) Received: (from raghu@localhost) by riemann.mri.ernet.in (8.12.9p2/8.12.9/Submit) id i4Q6jvCm017896; Wed, 26 May 2004 12:15:57 +0530 (IST) (envelope-from raghu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16564.15653.674179.246862@riemann.mri.ernet.in> Date: Wed, 26 May 2004 12:15:57 +0530 From: "N. Raghavendra" To: Matthew Seaman In-Reply-To: <20040525144451.GA49822@happy-idiot-talk.infracaninophile.co.uk> References: <16563.20591.846129.789297@riemann.mri.ernet.in> <20040525144451.GA49822@happy-idiot-talk.infracaninophile.co.uk> X-Mailer: VM 7.18 under Emacs 21.3.1 X-Organization: Harish-Chandra Research Institute (HRI) X-Address: Chhatnag Road, Jhusi, Allahabad 211 019, India X-URL: http://www.mri.ernet.in/ X-Phone: +91 (532) 2667 509, 2667 318, 2667 578, 2567 746, 2567 747 X-Fax: +91 (532) 2667 576, 2567 748, 2567 444, 2568 036 X-OpenPGP-Key-ID: 0x03618806 X-OpenPGP-Key-Fingerprint: C75D D0AF 457E 7454 BEC2 37AD C6E1 0407 0361 8806 X-OpenPGP-Public-Key-Available-At: http://www.keyserver.net/ cc: FreeBSD Questions Subject: Re: `call' function in `make' X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "N. Raghavendra" List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2004 06:48:34 -0000 At 2004-05-25T15:44:51+01:00, Matthew Seaman wrote: > > Is there an analogue in BSD `make' of the `call' function in `gmake': > > $(call VARIABLE,PARAM,PARAM,...)? > > Not as such. You can however use the '!=' operator to assign a value > to a variable based on the output of some external command: > > RATIO != sh -c 'echo $$(( $a / $b ))' Hi Matthew, Thanks for your reply. After writing to the list yesterday, I read make(1) carefully, and found what I wanted, namely the shell command for creating `dir1' in this example `Makefile': ### Makefile ## Create directory FOO if it does not exist. create_dir = if test ! -d foo ; then rm -f foo ; mkdir foo ; fi dir1: src1 $(create_dir:S/foo/$@/g) dir2: src2 $(create_dir:foo=$@) ### Makefile ends here However, I don't understand something. The command for `dir1' works perfectly well: % make dir1 if test ! -d dir1 ; then rm -f dir1 ; mkdir dir1 ; fi (`dir1' created) OTOH, the command for `dir2' does not work --- `make' is not expanding the local variable `@': % make dir2 if test ! -d $@ ; then rm -f $@ ; mkdir $@ ; fi (`dir2' not created) Can someone tell me why this is happening? Thanks, Raghavendra. -- N. Raghavendra | See mail headers for contact Harish-Chandra Research Institute | and OpenPGP details.