Trepan-Debuggers / remake

Enhanced GNU Make - tracing, error reporting, debugging, profiling and more
http://bashdb.sf.net/remake
GNU General Public License v3.0
796 stars 75 forks source link

Add this_file, this_counter, GNUremake #116

Open rocky opened 3 years ago

rocky commented 3 years ago

@bstarynk this addresses the build failure and has a test for GNUremakefile

However I don't see that the this_ functions work.

For example for this Makefile

B = c d $(this_file) $(this_line) $(this_counter)

x:
    @echo $(B)

I get:

$ ../make -x -f this.Makefile
Reading makefiles...
Updating makefiles...
Updating goal targets...
 File 'x' does not exist.
Must remake target 'x'.
this.Makefile:5: target 'x' does not exist
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
echo c d   
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
c d
Successfully remade target file 'x'.

If the this functions work for you, maybe you can give an example simiilar to the above?

boretom commented 3 years ago

Hey, long time not chat :)

~I had a first look at it and the func-call-with-no-argument handling in function.c seems to need work. In the Makefile using something like C = c d $(this_file fluffy) works but C = c d $(this_file) doesn't.~

In the function table a function with a max of 0 args can't be specified since max=0 means no maximum. A workaround could be change the syntax, like $(this file). That would allow for a shorter form if file, line and counter is needed, e.g. $(this file counter) but does make argument checking necessary.

Without any args expand_builtin_function seems not to be called at all in the above case.

In the next few days I'll have a closer look.

/Thomas

Edit: Remove "there's no check for max # of arguments", the first paragraph was after I did some changing, not true for the unmodfied commit

rocky commented 3 years ago

@boretom Many thanks for investigating what's up, finding and fixing (at least some of) the problems and the review.

Also, all the best for 2021!

rocky commented 3 years ago

After the dust settles, we should look into adding a few more tests. It shouldn't be that onerous. (In fact, this is something I think even I could do.) Thanks again.