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