Enviroment variables in subdirectories' Makefiles

如果您是通过搜索引擎找到这儿来的,我想您应该也是正在读 《Autotools: a practitioner's guide to GNU autoconf, automake, and libool》 这本书


我在这儿列出了一些书中我目前不太能理解的片段,如果您能留言解释,实在是感谢!


我自己也会不定期更新我对这些内容的理解。


Page 48

-----------------------------------------------------------------------------------------
...
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
export prefix
export exec_prefix
export bindir
...
-----------------------------------------------------------------------------------------
Listing 2-26: Makefile: Adding the bindir variable
-----------------------------------------------------------------------------------------
...
install:
install -d $(bindir)
install -m 0755 jupiter $(bindir)
uninstall:
-rm $(bindir)/jupiter
...
-----------------------------------------------------------------------------------------
Listing 2-27: src/Makefile: Adding the bindir variable
 

Even though we only use bindir in src/Makefile, we have to export prefix, 
exec_prefix, and bindir because bindir is defined in terms of exec_prefix, which  is itself defined in terms of prefix. When make runs the install commands, it  will first resolve bindir to $(exec_prefix)/bin, then to $(prefix)/bin, and finally  to /usr/local/bin. Thus, src/Makefile needs to have access to all three variables  during this process.

我不太理解的是,bindir 在外层目录的Makefile中,被export到环境时,不是已经被展开(expanded)了吗,

为何文中还说,在src/Makefile中需要 “resolve bindir to $(exec_prefix)/bin, then to $(prefix)/bin, and finally” ?
to /usr/local/bin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值