From owner-freebsd-questions@FreeBSD.ORG Mon Jan 28 00:59:50 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 B392116A418 for ; Mon, 28 Jan 2008 00:59:50 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mx-out-05.forthnet.gr (mx-out.forthnet.gr [193.92.150.104]) by mx1.freebsd.org (Postfix) with ESMTP id 3258913C4D1 for ; Mon, 28 Jan 2008 00:59:49 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mx-av-01.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-05.forthnet.gr (8.13.8/8.13.8) with ESMTP id m0S0xmmb006781; Mon, 28 Jan 2008 02:59:48 +0200 Received: from MX-IN-04.forthnet.gr (mx-in-04.forthnet.gr [193.92.150.163]) by mx-av-01.forthnet.gr (8.14.1/8.14.1) with ESMTP id m0S0xmLf022144; Mon, 28 Jan 2008 02:59:48 +0200 Received: from kobe.laptop (ppp47-170.adsl.forthnet.gr [62.1.64.170]) by MX-IN-04.forthnet.gr (8.14.2/8.14.2) with ESMTP id m0S0xlgr031543; Mon, 28 Jan 2008 02:59:48 +0200 Authentication-Results: MX-IN-04.forthnet.gr smtp.mail=keramida@ceid.upatras.gr; spf=neutral Authentication-Results: MX-IN-04.forthnet.gr header.from=keramida@ceid.upatras.gr; sender-id=neutral Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m0S0xk0Y003129; Mon, 28 Jan 2008 02:59:46 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m0S0xjma003128; Mon, 28 Jan 2008 02:59:45 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 28 Jan 2008 02:59:44 +0200 From: Giorgos Keramidas To: Ivan Rambius Ivanov Message-ID: <20080128005944.GA3072@kobe.laptop> References: <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com> 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 List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 00:59:50 -0000 On 2008-01-28 00:48, Ivan Rambius Ivanov wrote: > Hello, > > I am developing a FreeBSD port and I would like to invoke a shell > command from it and assign its output to a variable. The command in > question is > > # make -f /usr/ports/lang/fpc/Makefile -V PORTVERSION > > and I have verified that it works on the command line. > > I try to use it in my port's Makefile in the following way: > > FPCVERSION= `make -f /usr/ports/lang/fpc/Makefile -V PORTVERSION` > > but it fails with the following error > > Syntax error: EOF in backquote substitution Try the BSD-specific syntax which uses bang-equal assignment to grab the output of a shell command and assign it to a make variable: FPCVERSION!= shell cmd here i.e. something like: FPCVERSION!= make -f ${PORTSDIR}/lang/fpc/Makefile -V PORTVERSION I'm curious though. Why do you have to find the value of the {PORTVERSION} from a Ports makefile? Perhaps there is already a `standard' feature of the Ports which can do something similar. Have you asked around in freebsd-ports? - Giorgos