我有一个像这样的文件路径列表:
FILE_PATH := a1.so a2.so bla/a3.so bla/a3.so bla/blo/a4.so....
Run Code Online (Sandbox Code Playgroud)
我需要在basename中添加一个前缀以获得:
FILE_PATH_PREFIX := liba1.so liba2.so bla/liba3.so bla/liba3.so bla/blo/liba4.so....
Run Code Online (Sandbox Code Playgroud)
任何的想法 ?
RC.*_*RC. 73
看看Make的addprefix功能.
这是我们使用addsuffix将obj文件放在源下面一个目录的示例.
SOURCE += MainThread.cpp SOURCE += Blah.cpp OBJ=$(join $(addsuffix ../obj/, $(dir $(SOURCE))), $(notdir $(SOURCE:.cpp=.o)))
从制作手册: http://www.gnu.org/software/make/manual/make.html
$(addprefix prefix,names...)
The argument names is regarded as a series of names, separated by whitespace;
prefix is used as a unit. The value of prefix is prepended to the front of each
individual name and the resulting larger names are concatenated with single
spaces between them. For example,
$(addprefix src/,foo bar)
produces the result `src/foo src/bar'.