Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
676 views
in Technique[技术] by (71.8m points)

gnu make - What does @: (at symbol colon) mean in a Makefile?

What does the following do in a Makefile?

rule: $(deps)
    @:

I can't seem to find this in the make manual.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It means "don't echo this command on the output." So this rule is saying "execute the shell command : and don't echo the output.

Of course the shell command : is a no-op, so this is saying "do nothing, and don't tell."

Why?

The trick here is that you've got an obscure combination of two different syntaxes. The make(1) syntax is the use of an action starting with @, which is simply not to echo the command. So a rule like

always:
       @echo this always happens

won't emit

   echo this always happens
   this always happens

Now, the action part of a rule can be any shell command, including :. Bash help explains this as well as anywhere:

$ help :
:: :
    Null command.

    No effect; the command does nothing.

    Exit Status:
    Always succeeds.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...