Escapar en makefile


Estoy tratando de hacer esto en un makefile y falla horriblemente:

M_ARCH := $(shell g++ -dumpmachine | awk '{split($1,a,"-");print a[1]}')

¿sabes por qué? Supongo que tiene que ver con escapar, pero, ¿qué y dónde?

Author: Jonas Byström, 2010-03-05

2 answers

Es el signo del dólar, en makefiles tendrás que escribir $$ para obtener un solo signo del dólar:

M_ARCH := $(shell g++ -dumpmachine | awk '{split($$1,a,"-");print a[1]}')
 128
Author: Martin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-03-04 21:21:54

Hacer es bastante lispy cuando se llega a ella. Aquí hay una versión no-awk que hace lo mismo:

space := $() #

M_ARCH := $(firstword $(subst -,$(space),$(shell g++ -dumpmachine)))

all:
    $(info $(M_ARCH))
 14
Author: richq,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-07 22:11:26