如何检测是否设置了makefile"--silent/-quiet"命令行选项? [英] How to detect if the makefile `--silent/--quiet` command line option was set?

查看:393
本文介绍了如何检测是否设置了makefile"--silent/-quiet"命令行选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测是否设置了makefile --silent / --quiet 命令行选项?

How to detect if the makefile --silent / --quiet command line options was set?

相关问题:

  1. 如何检测--quiet选项是否为用rake指定

推荐答案

如果调用 make --quiet --silent ,则变量 仅设置为 s .而且,如果您添加其他选项,例如 --ignore-errors --keep-going ,则变量 {MAKEFLAGS} 会设置为 iks .然后,您可以使用以下命令捕获它:

If you call either make --quiet or --silent, the variable {MAKEFLAGS} is set only to s. And if you add other options like --ignore-errors and --keep-going, the variable {MAKEFLAGS} is set to iks. Then, you can capture it with this:

ECHOCMD:=/bin/echo -e
SHELL := /bin/bash

all:
    printf 'Calling with "%s" %s\n' "${MAKECMDGOALS}" "${MAKEFLAGS}";

    if [[ "ws" == "w$(findstring s,${MAKEFLAGS})" ]]; then \
        printf '--silent option was set\n'; \
    fi

参考文献:

  1. 递归make:插入$(MAKEFLAGS)的正确方法
  2. 如何设置来自Makefile的MAKEFLAGS,以删除默认的隐式规则
  3. 要从MAKECMDGOALS中删除目标吗?
  4. https://www.gnu.org/software/autoconf/manual/autoconf-2.61/html_node/The-Make-Macro-MAKEFLAGS.html
  1. Recursive make: correct way to insert `$(MAKEFLAGS)`
  2. How to set MAKEFLAGS from Makefile, in order to remove default implicit-rules
  3. Remove target from MAKECMDGOALS?
  4. https://www.gnu.org/software/autoconf/manual/autoconf-2.61/html_node/The-Make-Macro-MAKEFLAGS.html

这篇关于如何检测是否设置了makefile"--silent/-quiet"命令行选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆