Slightly OT: Invoking a shell command from a Makeile
Giorgos Keramidas
keramida at ceid.upatras.gr
Sun Jan 27 16:59:50 PST 2008
On 2008-01-28 00:48, Ivan Rambius Ivanov <rambiusparkisanius at gmail.com> 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
More information about the freebsd-questions
mailing list