makefile - Why do the scripts and comments appear during execution? -


in makefile, have target called indent-fast --

indent-fast:     # astyle --style=allman --indent=tab `find . -name "*.java"`     files=`find . -name "*.java"` ; \     file in $$files ; \         echo formatting $$file ; \     done ;\     # whitesmith @ 4 spaces, uncomment line --     # astyle --style=whitesmith --indent=spaces=4 `find . -name "*.java"` 

but when execute it, output --

ramgorur@ramgorur-pc:~$ make indent-fast  # astyle --style=allman --indent=tab `find . -name "*.java"` files=`find . -name "*.java"` ; \     file in $files ; \         echo formatting $file ; \     done ;\ formatting ./file1.java formatting ./file2.java formatting ./file3.java . . . formatting ./filen.java # whitesmith @ 4 spaces, uncomment line -- # astyle --style=whitesmith --indent=spaces=4 `find . -name "*.java"` 

why showing scripts along comments on std output? please note indent-fast last target in file.

because comments indented in recipe, they're not make comments, , they're being executed part of recipe. they're shell comments in context. add @ prevent them being output, if that's goal.

from gnu make manual:

comments within recipe passed shell, other recipe text. shell decides how interpret it: whether or not comment shell.

simple example makefile:

# make comment target:     # shell comment     :     @# output-suppressed shell comment     @: 

execution:

$ make # shell comment : 

edit: since example wasn't enough, here's solution exact problem:

indent-fast:     @# astyle --style=allman --indent=tab `find . -name "*.java"`     @files=`find . -name "*.java"` ; \     file in $$files ; \         echo formatting $$file ; \     done     @# whitesmith @ 4 spaces, uncomment line --     @# astyle --style=whitesmith --indent=spaces=4 `find . -name "*.java"` 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -