开发者

Makefile: Expand relative PREFIX path

开发者 https://www.devze.com 2023-03-05 00:36 出处:网络
In my Makefile, there is a PREFIX variable for specifying where the finished files should be placed. However, internally, I need to use the absolute path of PREFIX because the working directory change

In my Makefile, there is a PREFIX variable for specifying where the finished files should be placed. However, internally, I need to use the absolute path of PREFIX because the working directory changes.

I tried something like

PREFIX=../out
REALPREFIX=`readlink -f $(PREFIX)`

which didn't work, and neither did

default: fixprefix $(addprefix $(REALPREFIX)/,$(OBJS))

fixprefix:
        REALPREFIX=`readlink -f $(PR开发者_Python百科EFIX)`

All I need is for the absolute path to be prefixed onto OBJS when the prerequisites list is calculated.


If you're using GNUMake, you can do this:

REALPREFIX = $(realpath $(PREFIX))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号