5

I've read in linux Makefile:

$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
    $(Q)@:

What is the meaning of $(Q)@:?

I'm trying to google it, but google always crappy if the search using some weird character. So in the end i can't found any Manual about it.

Danijel
  • 8,198
  • 18
  • 69
  • 133
nafsaka
  • 940
  • 2
  • 12
  • 17

3 Answers3

8

After looking in the code. Q is defined somewhere after those line. Since makefile have peculiar concept of variable (which is expandable), it can be implement in anywhere. Q is used to whether show message or not (Q maybe for Quiet).

ifeq ($(KBUILD_VERBOSE),1)
  quiet =
  Q =
else
  quiet=quiet_
  Q = @
endif

And for the last @: this means do-nothing-output-nothing.

So the conclusion $(Q)@: simply do-nothing-output-nothing.

Community
  • 1
  • 1
nafsaka
  • 940
  • 2
  • 12
  • 17
3

To reinforce and expand on what nafsaka found: Sometimes Makefiles are written like this:

target:
    rm -rf $(DIRECTORY)
    $(Q)$(MAKE) all

And Q will be defined as @ or nothing for example:

V ?= 0
ifeq ($(V), 0)
    Q = @
else
    Q =
endif

If a target action is preceded by @ then make won't display it when run. Here's the GNU make documentation on that subject: Recipe Echoing

In this case you need to define V=1 before running make to see commands as they're run (This is very common).

Another wrinkle: Look for "include file.mk" statements in your Makefile, which is where V and Q were defined in my case. Here's the GNU make documentation on include: Including Other Makefiles

Brad Dre
  • 3,580
  • 2
  • 19
  • 22
1

From the Make manual:

5.2 Recipe Echoing

Normally make prints each line of the recipe before it is executed. We call this echoing because it gives the appearance that you are typing the lines yourself.

When a line starts with ‘@’, the echoing of that line is suppressed. The ‘@’ is discarded before the line is passed to the shell. Typically you would use this for a command whose only effect is to print something, such as an echo command to indicate progress through the makefile:

@echo About to make distribution files

When make is given the flag ‘-n’ or ‘--just-print’ it only echoes most recipes, without executing them. See Summary of Options. In this case even the recipe lines starting with ‘@’ are printed. This flag is useful for finding out which recipes make thinks are necessary without actually doing them.

The ‘-s’ or ‘--silent’ flag to make prevents all echoing, as if all recipes started with ‘@’. A rule in the makefile for the special target .SILENT without prerequisites has the same effect (see Special Built-in Target Names).

Danijel
  • 8,198
  • 18
  • 69
  • 133