Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2008 01:26:26 +0200
From:      "Ivan \"Rambius\" Ivanov" <rambiusparkisanius@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Slightly OT: Invoking a shell command from a Makeile
Message-ID:  <89ce7f740801271526p2e7721e0g72e89bd22c4c31d2@mail.gmail.com>
In-Reply-To: <479D0ECB.1080605@student.utwente.nl>
References:  <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com> <479D0ECB.1080605@student.utwente.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Alphons,

On Jan 28, 2008 1:07 AM, Alphons Fonz van Werven
<a.j.werven@student.utwente.nl> wrote:
> 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...
I do use BSD make and not GNU make, but your examples gave me a hint
what I should search on google and I found the exact syntax:

FPCVERSION!=            make -f ${PORTSDIR}/lang/fpc/Makefile -V PORTVERSION

The assignment is done by the bang equals sign "!=" and I found it
explained here http://www.khmere.com/freebsd_book/html/ch01.html

Thank you for your quick response.

Regards
Rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?89ce7f740801271526p2e7721e0g72e89bd22c4c31d2>