makefile - Using notdir within substitution reference as opposed to patsubst -


in makefile, stripping file paths list of objects, , replacing path build directory.

using patsubst, seems work fine, using substitution replacements doesnt seem work, e.g:

objs=/path/to/obj1.o /another/path/obj2.o build_dir=build  $(info patsubst = $(patsubst %, $(build_dir)/%, $(notdir $(objs))))  $(info substref = $( $(notdir $(objs)):%=$(build_dir)/%) ) 

the output of :

patsubst = build/obj1.o build/obj2.o

substref =

is shortcoming of substitution references or doing wrong?

im using gnu make 4.1, makefile valid other/older versions.

that syntax not right. substitution reference requires variable name in first part, , make expand variable , substitution performed on expansion. giving $(notdir $(objs)) thing substitute on, , expands set of strings, not variable name.

patsubst works fine here why need use substitution reference?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -