Bail out if any command fails.

pull/15/head
Jussi Pakkanen 12 years ago
parent a455780ccf
commit 9f7e1bd826
  1. 9
      shellgenerator.py

@ -32,6 +32,7 @@ class ShellGenerator():
outfile.write('#!/bin/sh\n\n') outfile.write('#!/bin/sh\n\n')
outfile.write('echo This is an autogenerated shell script build file for project \\"%s\\".\n' outfile.write('echo This is an autogenerated shell script build file for project \\"%s\\".\n'
% self.interpreter.get_project()) % self.interpreter.get_project())
outfile.write('echo This is experimental and most likely will not work!\n')
self.generate_commands(outfile) self.generate_commands(outfile)
outfile.close() outfile.close()
os.chmod(outfilename, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC |\ os.chmod(outfilename, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC |\
@ -58,9 +59,9 @@ class ShellGenerator():
commands.append(abs_src) commands.append(abs_src)
commands += compiler.get_output_flags() commands += compiler.get_output_flags()
commands.append(abs_obj) commands.append(abs_obj)
quoted = environment.shell_quote(commands) + ['\n'] quoted = environment.shell_quote(commands)
outfile.write('\necho Compiling \\"%s\\"\n' % src) outfile.write('\necho Compiling \\"%s\\"\n' % src)
outfile.write(' '.join(quoted)) outfile.write(' '.join(quoted) + ' || exit\n')
return abs_obj return abs_obj
def generate_link(self, target, outfile, outname, obj_list): def generate_link(self, target, outfile, outname, obj_list):
@ -72,9 +73,9 @@ class ShellGenerator():
commands += dep.get_link_flags() commands += dep.get_link_flags()
commands += linker.get_output_flags() commands += linker.get_output_flags()
commands.append(outname) commands.append(outname)
quoted = environment.shell_quote(commands) + ['\n'] quoted = environment.shell_quote(commands)
outfile.write('\necho Linking \\"%s\\".\n' % outname) outfile.write('\necho Linking \\"%s\\".\n' % outname)
outfile.write(' '.join(quoted)) outfile.write(' '.join(quoted) + ' || exit\n')
def generate_commands(self, outfile): def generate_commands(self, outfile):
for i in self.interpreter.get_executables().items(): for i in self.interpreter.get_executables().items():

Loading…
Cancel
Save