makefile2graph icon indicating copy to clipboard operation
makefile2graph copied to clipboard

Pattern rules with multiple targets not shown

Open dacodas opened this issue 4 years ago • 2 comments

Consider the following Makefile

all: hello.b hello.c

hello.a:
    touch $@

%.b %.c: %.a
    touch $*.b $*.c

Instead of properly connecting the two pattern rule targets, only one of them is connected the in the dot output

wrong

should-be

I believe this is because the make -d output just says that the second has "already been considered"

# make -rRBndC example
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Updating makefiles....
 Considering target file 'Makefile'.
  Looking for an implicit rule for 'Makefile'.
  No implicit rule found for 'Makefile'.
  Finished prerequisites of target file 'Makefile'.
 No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'all'.
 File 'all' does not exist.
 Looking for an implicit rule for 'all'.
 No implicit rule found for 'all'.
  Considering target file 'hello.b'.
   Looking for an implicit rule for 'hello.b'.
   Trying pattern rule with stem 'hello'.
   Trying implicit prerequisite 'hello.a'.
   Found an implicit rule for 'hello.b'.
    Considering target file 'hello.a'.
     Finished prerequisites of target file 'hello.a'.
    Making 'hello.a' due to always-make flag.
    Must remake target 'hello.a'.
make[1]: Entering directory '/home/dacoda/projects/tea-dragon-society/src/third-party/makefile2graph/test/example'
touch hello.a
    Successfully remade target file 'hello.a'.
   Finished prerequisites of target file 'hello.b'.
   Prerequisite 'hello.a' is newer than target 'hello.b'.
  Must remake target 'hello.b'.
touch hello.b hello.c
  Successfully remade target file 'hello.b'.
  Considering target file 'hello.c'.
  File 'hello.c' was considered already.
 Finished prerequisites of target file 'all'.
Must remake target 'all'.
Successfully remade target file 'all'.
make[1]: Leaving directory '/home/dacoda/projects/tea-dragon-society/src/third-party/makefile2graph/test/example'

With a different flag, however, it seems possible to have make let us know that it is building more than one file with a single recipe

# make -rRpBC example | grep -C5 'Also makes'
    touch $@

hello.b: hello.a
#  Implicit rule search has been done.
#  Implicit/static pattern stem: 'hello'
#  Also makes: hello.c
#  Last modified 2020-09-18 17:55:32.792450404
#  File has been updated.
#  Successfully updated.
# automatic
# @ := hello.b

dacodas avatar Sep 19 '20 00:09 dacodas

Thank you for this report ! I'm afraid I won't have the time to fix this soon.

lindenb avatar Sep 19 '20 09:09 lindenb

No worries! I'll give it a shot over the next while and make a pull request. This issue helps keep it fresh in my mind.

Thanks for the tool and for your quick response 😄😄

dacodas avatar Sep 19 '20 16:09 dacodas