Reputation: 16016
Suppose I have the following Makefile with an intentional error in line 4:
define TEMPLATE all: this line contains some errors endef $(eval $(call TEMPLATE))
When I run make I get this:
$ make-3.81 Makefile:7: *** missing separator. Stop. $
Make is telling me that there is an error in line 7, which is technically correct because the TEMPLATE variable is expanded on line 7. But this is not tremendously useful. In order to quickly debug this sort of thing it would be much more handy if make could somehow point me directly to the error on line 4. Is there any way to do this?
In case it makes any difference, this is GNU make-3.81.
Upvotes: 1
Views: 408
Reputation: 16840
Electric Make, a high-performance GNU-make-compatible implementation of make, reports errors the way you want:
$ cat Makefile
define BOGUS
foo: bar
abcd
endef
$(eval $(BOGUS))
$ gmake
Makefile:7: *** missing separator. Stop.
$ emake
Makefile:7:eval:2: *** missing separator. Stop.
It's a commercial product, but you can download a free version from Electric Cloud.
Disclaimer: I am the architect of Electric Make
Upvotes: 1