Hello all,

I am French and using GNU make (with GNU guile) version GNU Make 4.4.1 on a 
Debian Testing (or Ubuntu) computer with x86-64. 

Is there a simple way to get the current line number (in a similar way of 
__LINE__ in C++ code) in a GNUmakefile?

Maybe adding a $(__LINE__) and $(__FILE__) GNUmakefile functions?

In other words, adding a GNU make feature so that the following GNUmakefile 
example:

.PHONY: tell-lines

tell-lines:
        printf "tell-lines at %s:%d\n" $(__LINE__) $(__FILE__)


when invoked as make tell-lines is outputing

tell-lines at GNUmakefile:4


I could even try to implement it if adding that feature is simple (less than a 
day of coding on Linux) if given some concrete guidance.....

Respectful regards


NB: this is useful in the RefPerSys free software project - it has an ugly 
GNUmakefile (and I don't want to use generators like cmake)

-- 

Basile STARYNKEVITCH                    basile AT starynkevitch DOT net
8 rue de la Faïencerie                       http://starynkevitch.net/Basile/  
92340 Bourg-la-Reine                         https://github.com/bstarynk
France                                https://github.com/RefPerSys/RefPerSys
                  https://orcid.org/0000-0003-0908-5250

Reply via email to