parameters: (args, env, cwd, cb)
docstring: Start a single makefile execution, given a command line, working directory, and environment.
  
      @param cb a callback to notify with an exit code when make execution is finished.
docstring_summary: Start a single makefile execution, given a command line, working directory, and environment.
docstring_tokens: Start a single makefile execution given a command line working directory and environment .
function: def main(args, env, cwd, cb):
      """
      Start a single makefile execution, given a command line, working directory, and environment.
  
      @param cb a callback to notify with an exit code when make execution is finished.
      """
  
      try:
          makelevel = int(env.get('MAKELEVEL', '0'))
  
          op = OptionParser()
          op.add_option('-f', '--file', '--makefile',
                        action='append',
                        dest='makefiles',
                        default=[])
          op.add_option('-d',
                        action="store_true",
                        dest="verbose", default=False)
          op.add_option('-k', '--keep-going',
                        action="store_true",
                        dest="keepgoing", default=False)
          op.add_option('--debug-log',
                        dest="debuglog", default=None)
          op.add_option('-C', '--directory',
                        dest="directory", default=None)
          op.add_option('-v', '--version', action="store_true",
                        dest="printversion", default=False)
          op.add_option('-j', '--jobs', type="int",
                        dest="jobcount", default=1)
          op.add_option('-w', '--print-directory', action="store_true",
                        dest="printdir")
          op.add_option('--no-print-directory', action="store_false",
                        dest="printdir", default=True)
          op.add_option('-s', '--silent', action="store_true",
                        dest="silent", default=False)
          op.add_option('-n', '--just-print', '--dry-run', '--recon',
                        action="store_true",
                        dest="justprint", default=False)
  
          options, arguments1 = op.parse_args(parsemakeflags(env))
          options, arguments2 = op.parse_args(args, values=options)
  
          op.destroy()
  
          arguments = arguments1 + arguments2
  
          if options.printversion:
              _version()
              cb(0)
              return
  
          shortflags = []
          longflags = []
  
          if options.keepgoing:
              shortflags.append('k')
  
          if options.printdir:
              shortflags.append('w')
  
          if options.silent:
              shortflags.append('s')
              options.printdir = False
  
          if options.justprint:
              shortflags.append('n')
  
          loglevel = logging.WARNING
          if options.verbose:
              loglevel = logging.DEBUG
              shortflags.append('d')
  
          logkwargs = {}
          if options.debuglog:
              logkwargs['filename'] = options.debuglog
              longflags.append('--debug-log=%s' % options.debuglog)
  
          if options.directory is None:
              workdir = cwd
          else:
              workdir = util.normaljoin(cwd, options.directory)
  
          if options.jobcount != 1:
              longflags.append('-j%i' % (options.jobcount,))
  
          makeflags = ''.join(shortflags)
          if len(longflags):
              makeflags += ' ' + ' '.join(longflags)
  
          logging.basicConfig(level=loglevel, **logkwargs)
  
          context = process.getcontext(options.jobcount)
  
          if options.printdir:
              print "make.py[%i]: Entering directory '%s'" % (makelevel, workdir)
              sys.stdout.flush()
  
          if len(options.makefiles) == 0:
              if os.path.exists(util.normaljoin(workdir, 'Makefile')):
                  options.makefiles.append('Makefile')
              else:
                  print "No makefile found"
                  cb(2)
                  return
  
          ostmts, targets, overrides = parserdata.parsecommandlineargs(arguments)
  
          _MakeContext(makeflags, makelevel, workdir, context, env, targets, options, ostmts, overrides, cb)
      except (util.MakeError), e:
          print e
          if options.printdir:
              print "make.py[%i]: Leaving directory '%s'" % (makelevel, workdir)
          sys.stdout.flush()
          cb(2)
          return
function_tokens: def main ( args , env , cwd , cb ) : try : makelevel = int ( env . get ( 'MAKELEVEL' , '0' ) ) op = OptionParser ( ) op . add_option ( '-f' , '--file' , '--makefile' , action = 'append' , dest = 'makefiles' , default = [ ] ) op . add_option ( '-d' , action = "store_true" , dest = "verbose" , default = False ) op . add_option ( '-k' , '--keep-going' , action = "store_true" , dest = "keepgoing" , default = False ) op . add_option ( '--debug-log' , dest = "debuglog" , default = None ) op . add_option ( '-C' , '--directory' , dest = "directory" , default = None ) op . add_option ( '-v' , '--version' , action = "store_true" , dest = "printversion" , default = False ) op . add_option ( '-j' , '--jobs' , type = "int" , dest = "jobcount" , default = 1 ) op . add_option ( '-w' , '--print-directory' , action = "store_true" , dest = "printdir" ) op . add_option ( '--no-print-directory' , action = "store_false" , dest = "printdir" , default = True ) op . add_option ( '-s' , '--silent' , action = "store_true" , dest = "silent" , default = False ) op . add_option ( '-n' , '--just-print' , '--dry-run' , '--recon' , action = "store_true" , dest = "justprint" , default = False ) options , arguments1 = op . parse_args ( parsemakeflags ( env ) ) options , arguments2 = op . parse_args ( args , values = options ) op . destroy ( ) arguments = arguments1 + arguments2 if options . printversion : _version ( ) cb ( 0 ) return shortflags = [ ] longflags = [ ] if options . keepgoing : shortflags . append ( 'k' ) if options . printdir : shortflags . append ( 'w' ) if options . silent : shortflags . append ( 's' ) options . printdir = False if options . justprint : shortflags . append ( 'n' ) loglevel = logging . WARNING if options . verbose : loglevel = logging . DEBUG shortflags . append ( 'd' ) logkwargs = { } if options . debuglog : logkwargs [ 'filename' ] = options . debuglog longflags . append ( '--debug-log=%s' % options . debuglog ) if options . directory is None : workdir = cwd else : workdir = util . normaljoin ( cwd , options . directory ) if options . jobcount != 1 : longflags . append ( '-j%i' % ( options . jobcount , ) ) makeflags = '' . join ( shortflags ) if len ( longflags ) : makeflags += ' ' + ' ' . join ( longflags ) logging . basicConfig ( level = loglevel , * * logkwargs ) context = process . getcontext ( options . jobcount ) if options . printdir : print "make.py[%i]: Entering directory '%s'" % ( makelevel , workdir ) sys . stdout . flush ( ) if len ( options . makefiles ) == 0 : if os . path . exists ( util . normaljoin ( workdir , 'Makefile' ) ) : options . makefiles . append ( 'Makefile' ) else : print "No makefile found" cb ( 2 ) return ostmts , targets , overrides = parserdata . parsecommandlineargs ( arguments ) _MakeContext ( makeflags , makelevel , workdir , context , env , targets , options , ostmts , overrides , cb ) except ( util . MakeError ) , e : print e if options . printdir : print "make.py[%i]: Leaving directory '%s'" % ( makelevel , workdir ) sys . stdout . flush ( ) cb ( 2 ) return