makefile - How to pass a variable with spaces in its value as a single argument to a GNU make function? -


this makefile.

mypath = /dir 1/file 1.txt  test1:     echo $(notdir $(mypath))  test2:     echo $(notdir "$(mypath)")  test3:     echo todo 

my intention file 1.txt portion of path /dir 1/file 1.txt. yes, path spaces in it.

i unable desired results.

$ make test1 echo dir file 1.txt dir file 1.txt 

in above output, appears notdir provided 3 separate arguments: /dir, 1/file , 1.txt , result notdir parts returned: dir, file , 1.txt.

the following not work @ all.

$ make test2 echo dir file 1.txt" /bin/sh: 1: syntax error: unterminated quoted string makefile:7: recipe target 'test2' failed make: *** [test2] error 2 

why complain "unterminated quoted string"?

what right way solve problem. want output following.

$ make test3 echo file 1.txt file 1.txt 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -