Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I print message in Makefile?

Tags:

makefile

I want to print some message while doing build process with a makefile. The following one can print the message, but it will not execute the script after it. How can I fix this issues?

ifeq (yes, ${TEST})         CXXFLAGS := ${CXXFLAGS} -DDESKTOP_TEST test:         @echo '************  TEST VERSION ************' else release:         @echo "************ RELEASE VERSIOIN **********" endif 
like image 220
Dan Avatar asked Aug 02 '12 10:08

Dan


People also ask

What does @echo mean in makefile?

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.

What is := in makefile?

Expanded assignment = defines a recursively-expanded variable. := defines a simply-expanded variable.

How do you comment in makefile?

' # ' in a line of a makefile starts a comment. It and the rest of the line are ignored, except that a trailing backslash not escaped by another backslash will continue the comment across multiple lines. A line containing just a comment (with perhaps spaces before it) is effectively blank, and is ignored.


1 Answers

It's not clear what you want, or whether you want this trick to work with different targets, or whether you've defined these targets elsewhere, or what version of Make you're using, but what the heck, I'll go out on a limb:

ifeq (yes, ${TEST}) CXXFLAGS := ${CXXFLAGS} -DDESKTOP_TEST test: $(info ************  TEST VERSION ************) else release: $(info ************ RELEASE VERSIOIN **********) endif 
like image 176
Beta Avatar answered Oct 02 '22 01:10

Beta