[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: including makefile name and line number for shell_function_completed
From: |
Philip Guenther |
Subject: |
Re: including makefile name and line number for shell_function_completed |
Date: |
Sat, 31 Jul 2010 20:30:39 -0700 |
On Sat, Jul 31, 2010 at 4:54 PM, Jon Grant <address@hidden> wrote:
> I am using make 3.81 built for MinGW.
>
> How easy to output the Makefile.mak:line for each command that fails to start?
I don't think there's any way for a snippet of Makefile to figure out
what its line # and filename are. The $(warning) function will
include them in its output, but I don't see any way to trigger that
based on the success or failure of a command without completely
changing how the makefile operates.
Hmm.
So, what's needed is for a future version of GNU make to provide some
way to get the current filename and line number. Now, that could mean
a number of things. The *obvious* answer would be to provide
$(filename) and $(linenumber) functions that expand to the line number
and filename where they are expanded. I'm 80% sure that that's the
right choice. Consider the following sort of makefile:
------
define rules
echo "build $@ at $(filename):$(linenumber)"
@touch $@
endef
foo:
$(rules)
------
Should the reported line number be that of the use of $(rules), or
should it be where $(linenumber) was writen? I'm mostly convinced
that the answer is the former, but I have slight misgivings and I
suspect there are places where someone would want immediate expansion.
Philip Guenther