lindenb/makefile2graph

Cannot get target name in "Considering target file 'makefile'.".

davetgerrard opened this issue · 12 comments

Hi Pierre,
Just trying out makefile2graph on a very basic makefile:-

all : file1

file1: file0
cat file0 > file1

I get this error:-

$ make -Bnd | make2graph
Cannot get target name in "Considering target file 'makefile'.".
make: write error

Am I missing something?

only test

make -Bnd 

if you get the same error, then it comes from your Makefile, not from my tool.

I get a lot of output, but not the error.

$ make -Bnd | grep 'Cannot'

$ make -Bnd | grep 'error'

you cannot grep something on stderr !

$ make -Bnd 2>&1 | grep 'error'

Good point!
Still can't generate the error from the make file alone though.

please copy+paste your Makefile in a https://gist.github.com/ and give me the URL.

There's nothing more than what I put above.
https://gist.github.com/bc2cc3f5c5bf1304b368.git

file0 is an empty file.

It works fine on my side:

$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-linux-gnu

$ make -Bnd | ~/src/makefile2graph/make2graph 
digraph G {
n1[label="<ROOT>", color="green"];
n3[label="all", color="red"];
n5[label="file0", color="green"];
n4[label="file1", color="red"];
n2[label="makefile", color="green"];
n3 -> n1 ; 
n2 -> n1 ; 
n4 -> n3 ; 
n5 -> n4 ; 
}

Hmm, so at this point I have to confess I'm on a Windows system running Cygwin. The version of 'make' is 4.0.

I too can get the above to work using true GNU make (3.81) on a linux system.

I will try and change 'make' and see if that helps.

OK thanks, with make v4. I can reproduce the problem.
I'll try to fix this.

I pushed a new version 870f776

can you please tell me if that works for you ?

Yes! That is now working on my Cygwin GNU make 4.0 and under linux 3.80 systems.
Thankyou for doing that.

Dave

thank you for the report. Sorry, I didn't get the reason of the error at first sight