How to add multi line comments in makefiles

前端 未结 6 1833
野的像风
野的像风 2021-01-30 03:32

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

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 04:16

    A note about the idea of using ifeq to do multi-line comments in make(1). They don't work very well since if you write the following:

    ifeq (0,1)
        do not risk ifeq comments
        else trouble will find you
        ifeq is even worse
    endif
    

    The text between the ifeq and endif will still be parsed by make which means that you cannot write whatever you want in that section. And if you want to write a long comment and write whatever you want in the comment (including $ signs, colons and more which all have a meaning for make) then you must comment every single line. So why the ifeq...:)

提交回复
热议问题