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
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.
Expanded assignment = defines a recursively-expanded variable. := defines a simply-expanded variable.
' # ' 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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With