Controlling verbosity of make

后端 未结 5 636
粉色の甜心
粉色の甜心 2021-02-04 11:10

I\'m using a makefile to compile a program made of many .c files, and any time make is invoked it only compiles those files modified after the last run

5条回答
  •  忘了有多久
    2021-02-04 11:16

    Since I can't comment on the AT = $(AT_$(V)) suggestion, note that Automake does provide a standard macro that does the same thing as AT, which is called AM_V_at.

    You will also find that it has another very useful AM_V_GEN variable, that resolves either to nothing or to @echo " GEN " $@;, depending on the verbosity.

    This allows you to code something like this:

    grldr.mbr: mbrstart
        $(AM_V_GEN)
        $(AM_V_at)-rm -f grldr.mbr
        $(AM_V_at)cat mbrstart > grldr.mbr
    

    The output of which will be either (verbosity disabled):

      GEN    grldr.mbr
    

    or (verbosity enabled):

    rm -f grldr.mbr
    cat mbrstart > grldr.mbr
    

    Pretty convenient, and this removes the need to define your own macros.

提交回复
热议问题