makefile2graph icon indicating copy to clipboard operation
makefile2graph copied to clipboard

Support for makefiles with VPATH

Open jyn514 opened this issue 6 years ago • 0 comments

Makefile2graph shows incorrect output for makefiles using VPATH. Example:

ake -nd --no-builtin-rules 
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 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.
  Considering target file 'build/main'.
    Considering target file 'build/main.o'.
     Looking for an implicit rule for 'build/main.o'.
     Trying pattern rule with stem 'main'.
     Trying implicit prerequisite 'main.cpp'.
     Found prerequisite 'main.cpp' as VPATH 'src/main.cpp'
     Found an implicit rule for 'build/main.o'.
    No need to remake target 'build/main.o'.
   Finished prerequisites of target file 'build/main'.
   Prerequisite 'build/main.o' is older than target 'build/main'.
   Prerequisite 'build/response.o' is older than target 'build/main'.
   Prerequisite 'build/parse.o' is older than target 'build/main'.
   Prerequisite 'lib/libmagic.so' is older than target 'build/main'.
  No need to remake target 'build/main'.
 Finished prerequisites of target file 'all'.
Must remake target 'all'.
Successfully remade target file 'all'.
make: Nothing to be done for 'all'.

makefile2graph outputs

digraph G {
n2[label="all", color="red"];
n3[label="build/main", color="green"];
n4[label="build/main.o", color="green"];
n11[label="build/parse.o", color="green"];
n7[label="build/response.o", color="green"];
n14[label="lib/libmagic.so", color="green"];
n5[label="main.cpp", color="green"];
n12[label="parse.cpp", color="green"];
n10[label="parse.h", color="green"];
n8[label="response.cpp", color="green"];
n6[label="response.h", color="green"];
n13[label="src/parse.h", color="green"];
n9[label="src/response.h", color="green"];
n3 -> n2 ; 
n4 -> n3 ; 
n11 -> n3 ; 
n7 -> n3 ; 
n14 -> n3 ; 
n5 -> n4 ; 
n6 -> n4 ; 
n12 -> n11 ; 
n13 -> n11 ; 
n10 -> n7 ; 
n8 -> n7 ; 
n9 -> n7 ; 
}

At least half of those should start with src/.

jyn514 avatar Mar 25 '19 03:03 jyn514