V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
z0z
V2EX  ›  Linux

Makefile 中可以获取执行 make 时代有的参数和选项吗?

  •  
  •   z0z · Mar 27, 2019 · 3991 views
    This topic created in 2594 days ago, the information mentioned may be changed or developed.

    如执行 make clean,在 Makefile 中可以获取 clean 这个选项的吗? 就像 bash 中使用$1,$2 那样获取命令行的参数。

    3 replies    2019-03-27 10:45:51 +08:00
    kxuanobj
        1
    kxuanobj  
       Mar 27, 2019
    iwtbauh
        2
    iwtbauh  
       Mar 27, 2019 via Android
    可以这样

    make CC=clang

    可以覆盖 Makefile 里的 CC 变量
    z0z
        3
    z0z  
    OP
       Mar 27, 2019
    @kxuanobj 是的,编译目标这个已了解。对命令行的参数判断不想在编译目标那里处理。
    @iwtbauh 这个是方法是可行的,但是在执行 make 时需要指定一个类似 CC 这样的变量,没有 make clean 这样简洁。请原谅我的贪婪。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   968 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 18:10 · PVG 02:10 · LAX 11:10 · JFK 14:10
    ♥ Do have faith in what you're doing.