From owner-freebsd-questions@FreeBSD.ORG Sun Jan 27 23:08:02 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D79416A41A for ; Sun, 27 Jan 2008 23:08:02 +0000 (UTC) (envelope-from a.j.werven@student.utwente.nl) Received: from filter2-tmobile.zx.nl (filter2-tmobile.zx.nl [194.187.76.139]) by mx1.freebsd.org (Postfix) with ESMTP id C6DEE13C458 for ; Sun, 27 Jan 2008 23:08:01 +0000 (UTC) (envelope-from a.j.werven@student.utwente.nl) Received: from localhost (localhost.localdomain [127.0.0.1]) by filter2-tmobile.zx.nl (Postfix) with ESMTP id 8ACC11C72F3; Mon, 28 Jan 2008 00:07:57 +0100 (CET) X-Virus-Scanned: amavisd-new at zx.nl Received: from filter2-tmobile.zx.nl ([127.0.0.1]) by localhost (filter2.zx.nl [127.0.0.1]) (amavisd-new, port 10127) with ESMTP id KbSJn2uO+-nW; Mon, 28 Jan 2008 00:07:46 +0100 (CET) Received: from [127.0.0.1] (unknown [91.141.234.233]) by filter2-tmobile.zx.nl (Postfix) with ESMTP; Mon, 28 Jan 2008 00:07:45 +0100 (CET) Message-ID: <479D0ECB.1080605@student.utwente.nl> Date: Sun, 27 Jan 2008 23:07:55 +0000 From: "Alphons \"Fonz\" van Werven" User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "Ivan \"Rambius\" Ivanov" References: <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com> In-Reply-To: <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Slightly OT: Invoking a shell command from a Makeile X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 23:08:02 -0000 Ivan "Rambius" Ivanov wrote: > I am developing a FreeBSD port and I would like to invoke a shell > command from it and assign its output to a variable. If you're using GNU make (called gmake on BSD systems), you can do VAR := $(shell command) or, as a concrete example, CFILES := $(shell ls *.c) Not that I recommend using that example, it just goes to illustrate. If you're using BSD make, I wouldn't know though. I'm just not familiar with that. And if you wish to do it in a portable way such that it works with BSD make, GNU make or whatever, then all I can say is good luck... Hth, Alphons -- VISTA - Viruses Intruders Spyware Trojans Adware