Ucieczka w makefile

[[1]}próbuję to zrobić w makefile i strasznie mi się to nie udaje:

M_ARCH := $(shell g++ -dumpmachine | awk '{split($1,a,"-");print a[1]}')
Wiesz dlaczego? Myślę, że to ma związek z ucieczką, ale co i gdzie?
Author: Jonas Byström, 2010-03-05

2 answers

Jest to znak dolara, w makefiles musisz wpisać $$ aby otrzymać pojedynczy znak dolara:

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/doraprojects.net/template/agent.layouts/content.php on line 54
2010-03-04 21:21:54

Make jest dość lispy, kiedy się do niego dostać. Oto wersja nie-awk, która robi to samo:

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/doraprojects.net/template/agent.layouts/content.php on line 54
2010-08-07 22:11:26