Reputation: 29096
I realized that in with vim a comment is not highlighted when it is on the same line as a target:
mytarget: # A comment not highlighted
@echo foo
However, it seems my GNU make 3.82 treat them correctly.
I checked the manual, but I didn't see anything related to a comment in a target line.
Why vim or Notepad++ doesn't highlight these comments?
Upvotes: 2
Views: 951
Reputation: 80931
vim (or any other editor's) highlighting is only as good as the highlighting code written for the editor. It doesn't necessarily reflect what is or isn't legal for any given version of the language/etc. in question.
That being said I have no idea if a comment at that point is actually legal or not. The documentation doesn't appear to say specifically.
That being said, empirically, it appears that all of make 3.81
, 3.82
, 4.0
and 4.1
accept a comment in that location.
$ cat comment.mk
all: prereq # this is a comment
@echo '$@: $^'
$ /root/make/make-3.81/make -f comment.mk
all: prereq
$ /root/make/make-3.82/make -f comment.mk
all: prereq
$ /root/make/make-4.0/make -f comment.mk
all: prereq
$ /root/make/make-4.1/make -f comment.mk
all: prereq
Upvotes: 2