Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2008 23:07:55 +0000
From:      "Alphons \"Fonz\" van Werven" <a.j.werven@student.utwente.nl>
To:        "Ivan \"Rambius\" Ivanov" <rambiusparkisanius@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Slightly OT: Invoking a shell command from a Makeile
Message-ID:  <479D0ECB.1080605@student.utwente.nl>
In-Reply-To: <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com>
References:  <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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