gnu make - How to print out a variable in makefile -


in makefile, have variable 'ndk_project_path', question how can print out when compiles?

i read make file echo displaying "$path" string , tried:

@echo $(ndk_project_path) @echo $(value ndk_project_path) 

both gives me

"build-local.mk:102: *** missing separator.  stop." 

any 1 knows why not working me?

you can print out variables makefile read (assuming gnu make have tagged question appropriately) using method (with variable named "var"):

$(info $$var [${var}]) 

you can add construct recipe see make pass shell:

phony: all: ; $(info $$var [${var}])echo hello world 

now, happens here make stores entire recipe ($(info $$var [${var}])echo hello world) single recursively expanded variable. when make decides run recipe (for instance when tell build all), expands variable, , passes each resulting line separately shell.

so, in painful detail:

  • it expands $(info $$var [${var}])echo hello world
  • to first expands $(info $$var [${var}])
    • $$ becomes literal $
    • ${var} becomes :-) (say)
    • the side effect $var [:-)] appears on standard out
    • the expansion of $(info...) though empty
  • make left echo hello world
    • make prints echo hello world on stdout first let know it's going ask shell do
  • the shell prints hello world on stdout.

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -