makefile:如何在基本名称中添加前缀? [英] makefile: how to add a prefix to the basename?

查看:182
本文介绍了makefile:如何在基本名称中添加前缀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的文件路径列表:

I have a list of file path like that:

FILE_PATH := a1.so a2.so bla/a3.so bla/a3.so bla/blo/a4.so....

我需要在基本名称上添加前缀才能获得:

I need to add a prefix to the basename in order to get:

FILE_PATH_PREFIX := liba1.so liba2.so bla/liba3.so bla/liba3.so bla/blo/liba4.so....

有什么主意吗?

推荐答案

查看Make的addprefix函数.

Look at Make's addprefix function.

这是我们与addsuffix一起使用的示例,将obj文件放在一个目录下 来源.

Here is an example we use with addsuffix to place obj files one directory below the source.


SOURCE += MainThread.cpp
SOURCE += Blah.cpp

OBJ=$(join $(addsuffix ../obj/, $(dir $(SOURCE))), $(notdir $(SOURCE:.cpp=.o)))

从制造手册中:

From the make manual: 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'. 

这篇关于makefile:如何在基本名称中添加前缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆