Check for recursion

main
Michael Hayes 15 years ago
parent 81d1040226
commit 01461f4545

@ -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 $@

@ -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:

@ -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,7 +473,8 @@ def main(argv = None):
includes = '-I' + ' -I'.join (search_list)
gcc = options.cc + ' ' + options.cflags + ' ' + includes
print >> sys.stderr, gcc
if options.debug:
print >> sys.stderr, gcc
# Search main c file looking for header files included with #include
# and any header files included by the header files

Loading…
Cancel
Save