开发者

Makefile: Expand relative PREFIX path

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜