tags:

views:

435

answers:

5

How do I add comments (echo) in a Makefile that should be printed when run?

+2  A: 

Since a makefile mostly contains commands to be run when building specific targets, I'd say you use just that: echo.

Joey
A: 
all :
    echo "Building!"
    $(CC) $(OBJECTS) $(LPATH) $(LIBS) -o $(PROGRAM)
BenB
+1  A: 

A simple Google search would provide these results.

Also, this link has the answer

And the posters above gave the correct answers. Use Echo.

@All: there is no place for LMGTFY - it helps no-one, and is purely confrontational.
Marc Gravell
+1  A: 

Visual C++ nmake has the !message text... preprocessing directive. I have not used GNU make, so I don't if it has it as weel, but quick search shows it has the $(info text...) function.

And inside command blocks you can use echo.

Franci Penov
+8  A: 

You should use

target:
     @echo "Building!"

Note the @, which tells Make not to display the command itself. Without this the output would look like:

echo "Building!"
Building!
Alnitak
What is "bulding"?
Chris Lutz