Boris Berkgaut
Boris Berkgaut

Reputation: 175

Comments inside a multi-line list in makefile

I would like to have something like

BROKEN_THINGS = \ 
  thing1 \ # thing1 is completely broken
  thing2 \ # thing2 is broken too, see BUG-123

Look like this is not possible with [g]make.

I ended up using warning function (this works because $(warning X) always returns empty string):

BROKEN_THINGS = \
  thing1 $(warning "thing1 is completely broken") \
  thing2 $(warning "thing2 is broken too, see BUG-123") \

The last is not ideal since warnings garble the output of make (and also warning is a gmake-specific).

Is there a better solution to document a long multi-line list of things?

Upvotes: 6

Views: 3161

Answers (1)

MadScientist
MadScientist

Reputation: 100926

You can use:

BROKEN_THINGS =
BROKEN_THINGS += thing1  # thing1 is completely broken
BROKEN_THINGS += thing2  # thing2 is broken too, see BUG-123

Upvotes: 13

Related Questions