Make more robust

main
Michael Hayes 15 years ago
parent 45e9beb276
commit c9cffde9c5

@ -100,3 +100,4 @@ cleantest: $(CLEANTEST)
$(CLEANTEST): $(CLEANTEST):
-@$(MAKE) -f Makefile.test -C $(subst .cleantest,,$@) clean -@$(MAKE) -f Makefile.test -C $(subst .cleantest,,$@) clean

@ -234,6 +234,9 @@ def functions_find (gcc, filepath, functiondeps = {}):
rtlfilename = os.path.abspath (os.path.basename (filepath)) + '.012t.cfg' rtlfilename = os.path.abspath (os.path.basename (filepath)) + '.012t.cfg'
# print >> sys.stderr, rtlfilename # print >> sys.stderr, rtlfilename
if not os.path.exists (rtlfilename):
return
file = open (rtlfilename, 'r') file = open (rtlfilename, 'r')
text = file.readlines () text = file.readlines ()
file.close () file.close ()
@ -241,7 +244,8 @@ def functions_find (gcc, filepath, functiondeps = {}):
function = None function = None
for line in text: for line in text:
#print >> sys.stderr, line #print >> sys.stderr, line
matches = re.findall (r'^(.*)\s[(][)]', line) #matches = re.findall (r'^(.*)\s[(][)]', line)
matches = re.findall (r'^;; Function (.*)\s[(]', line)
if matches: if matches:
function = matches[0] function = matches[0]
functiondeps[function] = [] functiondeps[function] = []
@ -252,11 +256,11 @@ def functions_find (gcc, filepath, functiondeps = {}):
if function: if function:
functiondeps[function].append (matches[0]) functiondeps[function].append (matches[0])
else: else:
print >> sys.stderr, matches[0], 'used outside function", print >> sys.stderr, matches[0], 'used outside function in', filepath
command = 'rm ' + rtlfilename command = 'rm ' + rtlfilename
# print >> sys.stderr, command # print >> sys.stderr, command
os.system (command) # os.system (command)
def files_find (gcc, filepath, search_path, filedeps, moduledeps, functiondeps, indent, debug): def files_find (gcc, filepath, search_path, filedeps, moduledeps, functiondeps, indent, debug):
@ -285,11 +289,11 @@ def files_find (gcc, filepath, search_path, filedeps, moduledeps, functiondeps,
# Have found a module # Have found a module
modules.append (cpath) modules.append (cpath)
functions_find (gcc, filepath, functiondeps)
base, ext = os.path.splitext (os.path.basename (filepath)) base, ext = os.path.splitext (os.path.basename (filepath))
if ext == '.c': if ext == '.c':
functions_find (gcc, filepath, functiondeps)
moduledeps[base] = [] moduledeps[base] = []
for module in modules: for module in modules:
modbase, ext = os.path.splitext (os.path.basename (module)) modbase, ext = os.path.splitext (os.path.basename (module))
@ -326,6 +330,8 @@ def deps_print (target, depsdir, mopts, record = {}):
if record.has_key (target): if record.has_key (target):
return return
if not depsdir.has_key (target):
return
deps = depsdir[target] deps = depsdir[target]
deps = [dep for dep in deps if os.path.basename (dep) not in mopts['exclude']] deps = [dep for dep in deps if os.path.basename (dep) not in mopts['exclude']]
@ -444,6 +450,8 @@ def main(argv = None):
functiondeps = {} functiondeps = {}
files_find (gcc, maincfilename, search_path, filedeps, moduledeps, functiondeps, '', debug) files_find (gcc, maincfilename, search_path, filedeps, moduledeps, functiondeps, '', debug)
print >> sys.stderr, functiondeps
cfilelist = cfiles_get (filedeps) cfilelist = cfiles_get (filedeps)
ofilelist = [cfile[:-2] + mopts['objext'] for cfile in cfilelist] ofilelist = [cfile[:-2] + mopts['objext'] for cfile in cfilelist]
outfile = maincfilename[:-2] + mopts['exeext'] outfile = maincfilename[:-2] + mopts['exeext']

Loading…
Cancel
Save