Check for recursion
This commit is contained in:
+3
-3
@@ -22,9 +22,9 @@ APPFILEDEPS = $(addsuffix /file_dependencies.pdf, $(APPS))
|
||||
APPMODULEDEPS = $(addsuffix /module_dependencies.pdf, $(APPS))
|
||||
APPMAKEFILEDEPS = $(addsuffix /makefile_dependencies.pdf, $(APPS))
|
||||
APPBUILDDEPS = $(addsuffix /build_dependencies.pdf, $(APPS))
|
||||
APPCALLGRAPHDDEPS = $(addsuffix /callgraph.pdf, $(APPS))
|
||||
APPCALLGRAPHS = $(addsuffix /callgraph.pdf, $(APPS))
|
||||
|
||||
all: testmakefiles appmakefiles apps test appfiledeps appmoduledeps appmakefiledeps appbuilddeps appcallgraph
|
||||
all: testmakefiles appmakefiles apps test appfiledeps appmoduledeps appmakefiledeps appbuilddeps appcallgraphs
|
||||
|
||||
clean: cleanapps cleantest
|
||||
|
||||
@@ -44,7 +44,7 @@ appfiledeps: $(APPFILEDEPS)
|
||||
appmoduledeps: $(APPMODULEDEPS)
|
||||
appmakefiledeps: $(APPMAKEFILEDEPS)
|
||||
appbuilddeps: $(APPBUILDDEPS)
|
||||
appcallgraph: $(APPCALLGRAPH)
|
||||
appcallgraphs: $(APPCALLGRAPHS)
|
||||
|
||||
../%/file_dependencies.pdf: ../%/files.d
|
||||
./graphdeps.py $< --out $@
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
"""graphdeps V0.04
|
||||
"""graphdeps V0.05
|
||||
Copyright (c) 2011 Michael P. Hayes, UC ECE, NZ
|
||||
|
||||
Usage: graphdeps Makefile
|
||||
@@ -57,12 +57,11 @@ def node_output (dotfile, name, options):
|
||||
|
||||
shape = 'ellipse'
|
||||
if options.modules:
|
||||
# Maybe magenta
|
||||
colour = 'orange'
|
||||
shape = 'rectangle'
|
||||
|
||||
if options.calls:
|
||||
colour = 'magenta'
|
||||
colour = 'turquoise1'
|
||||
shape = 'rectangle'
|
||||
|
||||
dotfile.write ('\t"' + name + '"\t [style=filled,shape=' + shape + ',color=' + colour + '];\n')
|
||||
@@ -124,7 +123,7 @@ def target_output (dotfile, target, targets, modules, options, seen = {}):
|
||||
deps = targets[target]
|
||||
|
||||
for dep in deps:
|
||||
if targets.has_key (dep):
|
||||
if targets.has_key (dep) and target != dep:
|
||||
target_output (dotfile, dep, targets, modules, options, seen)
|
||||
|
||||
for dep in deps:
|
||||
|
||||
+9
-1
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
"""makemake V0.04
|
||||
"""makemake V0.05
|
||||
Copyright (c) 2010 Michael P. Hayes, UC ECE, NZ
|
||||
|
||||
This program tries to make a Makefile from a template. Given a C file
|
||||
@@ -343,8 +343,15 @@ def deps_print (target, depsdir, options, record = {}):
|
||||
return
|
||||
|
||||
deps = depsdir[target]
|
||||
|
||||
print >> sys.stderr, target + ': ', deps
|
||||
|
||||
deps = [dep for dep in deps if os.path.basename (dep) not in options.exclude]
|
||||
for dep in deps:
|
||||
# Have recursion
|
||||
if target == dep:
|
||||
continue
|
||||
|
||||
deps_print (dep, depsdir, options, record)
|
||||
|
||||
if options.relpath:
|
||||
@@ -466,6 +473,7 @@ def main(argv = None):
|
||||
includes = '-I' + ' -I'.join (search_list)
|
||||
gcc = options.cc + ' ' + options.cflags + ' ' + includes
|
||||
|
||||
if options.debug:
|
||||
print >> sys.stderr, gcc
|
||||
|
||||
# Search main c file looking for header files included with #include
|
||||
|
||||
Reference in New Issue
Block a user