out multiple - How to add multi line comments in makefiles

3 Answers

I believe the answer is no. The only comment styling I can find is # for each line, or use \ to wrap the first line.

lines rule recipe

Is there a way to comment out multiple lines in makefiles like as in C syntax /* */ ?

define BOGUS

Not exactly what you're looking for, but similar in spirit. I don't expect it to be the accepted answer, but maybe it can help someone.

Assuming you're editing your makefiles in VIM:
Either decide which lines you want to comment or select them with 'v'.

Then you can use the regex s/^/#/ to comment out the lines
and s/^#// to revert them.


  • To open the vim command line, press : (colon)
  • To prep the command for the next 'n' lines, use .,+n
  • A sample line using "v" looks like: '<,'>s/^/#/