Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$(shell) references in bash

Given the sample code form the Simian project Makefile:

OSX_VERSION=$(shell sw_vers -productVersion 2>/dev/null | cut -d. -f1-2)
SWIG=$(shell type -p swig 2>/dev/null)
SIMIAN_VERSION=2.4
SIMIAN=simian-${SIMIAN_VERSION}
SDIST_TAR=dist/simian-${SIMIAN_VERSION}.tar
SDIST=${SDIST_TAR}.gz
MUNKI_VERSION=2.3.0.2519
MUNKI=munkitools-${MUNKI_VERSION}
MUNKIFILE=${MUNKI}.pkg
PYTHON_VERSION=2.6
PYTHON=$(shell type -p python${PYTHON_VERSION})
TS=$(shell date '+%s')

I've tried to follow the makefile steps manually, but 'shell' is not referenced in the Makefile, or in my path. 'shell' is also absent from inside the VE created by the project.

Where is $(shell) referenced from?

like image 421
Dan O'Boyle Avatar asked Jun 21 '26 23:06

Dan O'Boyle


1 Answers

$(shell ...) is a built-in function in GNU make which is equivalent to the backtick-construct in standard make. It expands to the output of the command specified as arguments.

like image 90
JesperE Avatar answered Jun 24 '26 13:06

JesperE