Makefile: extract pattern from a full path string -


in makefile, can full path string $(curdir). result /home/jones/prj/platform/application_ubuntu/build_os. how extract ubuntu string?

i use subst replace '/' space.

dir = $(subst /, " ", $(curdir))

i result home jones prj platform application_ubuntu build_os.

then try use filter command cannot use % or wildcard match application_ubuntu out. in advance.

use penultimateword macro answer here.

penultimateword = $(wordlist $(words $1),$(words $1), x $1)  build_os=$(call penultimateword,$(subst /, ,$(curdir))) build_os=$(subst _, ,$(build_os)) build_os=$(word 2,$(build_os)) 

this sensitive underscores in path/etc.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -