build/pymake/make.py
author Mike Hommey <mh+mozilla@glandium.org>
Wed, 25 Jun 2014 08:38:12 +0900
changeset 190754 8aac3c8dc7bbe519da1accfe062adb34397296fb
parent 190610 59b0072d64aa5bebe2906b1778727d8172ac0f84
child 1987889 0797657470cb868f28dacd2e9fd77baa91cabc2e
child 2103133 11cd910394683e4894f57fe28100d81c22b69862
child 2146945 655c982db0925644c7b970f0200f804037981529
permissions -rwxr-xr-x
Bug 1027890 - Reject builds with pymake. r=gps

#!/usr/bin/env python

"""
make.py

A drop-in or mostly drop-in replacement for GNU make.
"""

import sys, os
import pymake.command, pymake.process

import gc

if __name__ == '__main__':
  if 'TINDERBOX_OUTPUT' in os.environ:
    # When building on mozilla build slaves, execute mozmake instead. Until bug
    # 978211, this is the easiest, albeit hackish, way to do this.
    import subprocess
    mozmake = os.path.join(os.path.dirname(__file__), '..', '..',
        'mozmake.exe')
    cmd = [mozmake]
    cmd.extend(sys.argv[1:])
    shell = os.environ.get('SHELL')
    if shell and not shell.lower().endswith('.exe'):
        cmd += ['SHELL=%s.exe' % shell]
    sys.exit(subprocess.call(cmd))

  sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
  sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)

  gc.disable()

  pymake.command.main(sys.argv[1:], os.environ, os.getcwd(), cb=sys.exit)
  pymake.process.ParallelContext.spin()
  assert False, "Not reached"