diff --git a/b2g/installer/Makefile.in b/b2g/installer/Makefile.in index 754312a9aa9..d139117bdaf 100644 --- a/b2g/installer/Makefile.in +++ b/b2g/installer/Makefile.in @@ -97,6 +97,8 @@ GARBAGE += $(MOZ_PKG_MANIFEST) endif ifdef FXOS_SIMULATOR +export MAKE + .PHONY: simulator simulator: make-package @echo 'Building simulator addon...' diff --git a/build/pymake/make.py b/build/pymake/make.py index 6334b464c46..0857f3f8ccf 100755 --- a/build/pymake/make.py +++ b/build/pymake/make.py @@ -18,13 +18,12 @@ if __name__ == '__main__': import subprocess mozmake = os.path.join(os.path.dirname(__file__), '..', '..', 'mozmake.exe') - if os.path.exists(mozmake): - 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)) + 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) diff --git a/config/baseconfig.mk b/config/baseconfig.mk index b4723a97068..1d4ee2d970c 100644 --- a/config/baseconfig.mk +++ b/config/baseconfig.mk @@ -25,9 +25,12 @@ _OBJ_SUFFIX := $(OBJ_SUFFIX) OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX) ifeq ($(HOST_OS_ARCH),WINNT) -# We only support building with pymake or a non-msys gnu make version +# We only support building with a non-msys gnu make version # strictly above 4.0. -ifndef .PYMAKE +ifdef .PYMAKE +$(error Pymake is no longer supported. Please upgrade to MozillaBuild 1.9 or newer and build with 'mach' or 'mozmake') +endif + ifeq (a,$(firstword a$(subst /, ,$(abspath .)))) $(error MSYS make is not supported) endif @@ -37,7 +40,7 @@ endif ifneq (4.0-,$(firstword $(sort 4.0- $(MAKE_VERSION)))) $(error Make version too old. Only versions strictly greater than 4.0 are supported.) endif -endif + ifdef INCLUDED_AUTOCONF_MK ifeq (a,$(firstword a$(subst /, ,$(srcdir)))) $(error MSYS-style srcdir are not supported for Windows builds.) @@ -45,11 +48,7 @@ endif endif endif # WINNT -ifdef .PYMAKE -include_deps = $(eval $(if $(2),,-)includedeps $(1)) -else include_deps = $(eval $(if $(2),,-)include $(1)) -endif ifndef INCLUDED_AUTOCONF_MK default:: diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 6afb09fbe9a..3456617a679 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -396,7 +396,7 @@ class MozbuildObject(ProcessExecutionMixin): srcdir=False, allow_parallel=True, line_handler=None, append_env=None, explicit_env=None, ignore_errors=False, ensure_exit_code=0, silent=True, print_directory=True, - pass_thru=False, num_jobs=0, force_pymake=False): + pass_thru=False, num_jobs=0): """Invoke make. directory -- Relative directory to look for Makefile in. @@ -408,11 +408,10 @@ class MozbuildObject(ProcessExecutionMixin): silent -- If True (the default), run make in silent mode. print_directory -- If True (the default), have make print directories while doing traversal. - force_pymake -- If True, pymake will be used instead of GNU make. """ self._ensure_objdir_exists() - args = self._make_path(force_pymake=force_pymake) + args = self._make_path() if directory: args.extend(['-C', directory.replace(os.sep, '/')]) @@ -475,44 +474,45 @@ class MozbuildObject(ProcessExecutionMixin): return fn(**params) - def _make_path(self, force_pymake=False): - if self._is_windows() and not force_pymake: - # Use gnumake if it's available and we can verify it's a working - # version. - baseconfig = os.path.join(self.topsrcdir, 'config', 'baseconfig.mk') - if os.path.exists(baseconfig): + def _make_path(self): + baseconfig = os.path.join(self.topsrcdir, 'config', 'baseconfig.mk') + + def validate_make(make): + if os.path.exists(baseconfig) and os.path.exists(make): + cmd = [make, '-f', baseconfig] + if self._is_windows(): + cmd.append('HOST_OS_ARCH=WINNT') try: - make = which.which('gnumake') - subprocess.check_call([make, '-f', baseconfig, 'HOST_OS_ARCH=WINNT'], - stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT) - return [make] + subprocess.check_call(cmd, stdout=open(os.devnull, 'wb'), + stderr=subprocess.STDOUT) except subprocess.CalledProcessError: - pass - except which.WhichError: - pass + return False + return True + return False - # Use mozmake if it's available. + possible_makes = ['gmake', 'make', 'mozmake', 'gnumake'] + + if 'MAKE' in os.environ: + make = os.environ['MAKE'] + if os.path.isabs(make): + if validate_make(make): + return [make] + else: + possible_makes.insert(0, make) + + for test in possible_makes: try: - return [which.which('mozmake')] - except which.WhichError: - pass - - if self._is_windows() or force_pymake: - make_py = os.path.join(self.topsrcdir, 'build', 'pymake', - 'make.py').replace(os.sep, '/') - - # We might want to consider invoking with the virtualenv's Python - # some day. But, there is a chicken-and-egg problem w.r.t. when the - # virtualenv is created. - return [sys.executable, make_py] - - for test in ['gmake', 'make']: - try: - return [which.which(test)] + make = which.which(test) except which.WhichError: continue + if validate_make(make): + return [make] - raise Exception('Could not find a suitable make implementation.') + if self._is_windows(): + raise Exception('Could not find a suitable make implementation.\n' + 'Please use MozillaBuild 1.9 or newer') + else: + raise Exception('Could not find a suitable make implementation.') def _run_command_in_srcdir(self, **args): return self.run_process(cwd=self.topsrcdir, **args) diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index e0a839b31e9..6dc01b1d3ee 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -267,15 +267,13 @@ class Build(MachCommandBase): @CommandArgument('--jobs', '-j', default='0', metavar='jobs', type=int, help='Number of concurrent jobs to run. Default is the number of CPUs.') @CommandArgument('what', default=None, nargs='*', help=BUILD_WHAT_HELP) - @CommandArgument('-p', '--pymake', action='store_true', - help='Force using pymake over GNU make.') @CommandArgument('-X', '--disable-extra-make-dependencies', default=False, action='store_true', help='Do not add extra make dependencies.') @CommandArgument('-v', '--verbose', action='store_true', help='Verbose output for what commands the build is running.') - def build(self, what=None, pymake=False, - disable_extra_make_dependencies=None, jobs=0, verbose=False): + def build(self, what=None, disable_extra_make_dependencies=None, jobs=0, + verbose=False): import which from mozbuild.controller.building import BuildMonitor from mozbuild.util import resolve_target_to_make @@ -343,8 +341,8 @@ class Build(MachCommandBase): # comprehensive history lesson. self._run_make(directory=self.topobjdir, target='backend.RecursiveMakeBackend', - force_pymake=pymake, line_handler=output.on_line, - log=False, print_directory=False) + line_handler=output.on_line, log=False, + print_directory=False) # Build target pairs. for make_dir, make_target in target_pairs: @@ -355,8 +353,7 @@ class Build(MachCommandBase): status = self._run_make(directory=make_dir, target=make_target, line_handler=output.on_line, log=False, print_directory=False, ensure_exit_code=False, num_jobs=jobs, silent=not verbose, - append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'}, - force_pymake=pymake) + append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'}) if status != 0: break @@ -365,7 +362,7 @@ class Build(MachCommandBase): status = self._run_make(srcdir=True, filename='client.mk', line_handler=output.on_line, log=False, print_directory=False, allow_parallel=False, ensure_exit_code=False, num_jobs=jobs, - silent=not verbose, force_pymake=pymake) + silent=not verbose) make_extra = self.mozconfig['make_extra'] or [] make_extra = dict(m.split('=', 1) for m in make_extra) @@ -374,8 +371,7 @@ class Build(MachCommandBase): if moz_automation and status == 0: status = self._run_make(target='automation/build', line_handler=output.on_line, log=False, print_directory=False, - ensure_exit_code=False, num_jobs=jobs, silent=not verbose, - force_pymake=pymake) + ensure_exit_code=False, num_jobs=jobs, silent=not verbose) self.log(logging.WARNING, 'warning_summary', {'count': len(monitor.warnings_database)},