简体   繁体   English

更改Makefile版本

[英]Change Makefile version

I need to use make-3.8.2 version for compiling code. 我需要使用make-3.8.2版本来编译代码。 I have modified makefile in following way. 我已经按照以下方式修改了makefile。

export PATH := /home/make-3.82/bin:$(PATH)

I am able to change PATH variable But it Invoke current make version which is make-3.7.6. 我可以更改PATH变量,但是它调用当前的make版本,即make-3.7.6。

if I set manually in terminal than it's work fine which is also correct as it takes from Path 如果我在终端中手动设置比它正常工作,那也是正确的,因为它取自Path

So is it possible to override make file version or any init function where we can override make file version after running make command 因此有可能覆盖make文件版本或任何运行make命令后可以覆盖make file版本的init函数

In simple words, check make file version and if it's not set make file version 3.8.2 or report any error ( any option is fine) 简而言之,请检查生成文件版本,如果未设置,请检查生成文件版本3.8.2或报告任何错误(任何选项都可以)

My Purpose is, we can handle make file version inside Makefile rather than any .cshrc or .bashrc to avoid any enviroment setup 我的目的是,我们可以在Makefile中处理make文件版本,而不是任何.cshrc或.bashrc,以避免任何环境设置

I have doing following way in makefile. 我在makefile中执行以下方法。

ifneq ($(MAKE_VERSION), 3.82)
    $(error Please add /home/make-3.82/bin in PATH enviroment and re run)
endif

If you set PATH from your makefile make already runs in the old version. 如果您从makefile设置PATH,则make已在旧版本中运行。 I don't know under which OS/shell you are working. 我不知道您在哪个OS / shell下工作。 For bash you have to set your PATH var in ~/.bashrc. 对于bash,您必须在〜/ .bashrc中设置PATH变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM