author | Ted Mielczarek <ted@mielczarek.org> |
Wed, 12 Dec 2012 11:32:05 -0500 | |
changeset 115809 | 0cf8797b8fc7d055c7dbcd78fc24685070121b7b |
parent 115808 | f17233a2e6ab75851557ba5452f7edbf3df840f8 |
child 115810 | f5eed31150f2c56f19aa664208e5b26baead7dd5 |
push id | 24028 |
push user | emorley@mozilla.com |
push date | Thu, 13 Dec 2012 15:56:02 +0000 |
treeherder | autoland@9db79b97abbb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jesup |
bugs | 820769 |
milestone | 20.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py | file | annotate | diff | comparison | revisions |
--- a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py +++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py @@ -38,17 +38,17 @@ VPATH = %(srcdir)s """ COMMON_FOOTER = """ # Skip rules that deal with regenerating Makefiles from Makefile.in files. NO_MAKEFILE_RULE = 1 NO_SUBMAKEFILES_RULE = 1 include $(topsrcdir)/config/rules.mk -include $(DEPTH)/%(relative_path)s/common.mk +include %(common_mk_path)s """ COMMON_MK = """# This file was generated by mozmake.py. Do not edit it directly. ifndef COMMON_MK_INCLUDED COMMON_MK_INCLUDED := 1 ifdef MOZ_DEBUG CFLAGS += $(CPPFLAGS_Debug) $(CFLAGS_Debug) @@ -135,32 +135,32 @@ def CalculateVariables(default_variables def CalculateGeneratorInputInfo(params): """Calculate the generator specific info that gets fed to input (called by gyp).""" generator_flags = params.get('generator_flags', {}) if generator_flags.get('adjust_static_libraries', False): global generator_wants_static_library_dependencies_adjusted generator_wants_static_library_dependencies_adjusted = True -def WriteMakefile(filename, data, build_file, depth, topsrcdir, srcdir, relative_path, extra_data=None): +def WriteMakefile(filename, data, build_file, depth, topsrcdir, srcdir, relative_path, common_mk_path, extra_data=None): if not os.path.isabs(topsrcdir): topsrcdir = depth + "/" + topsrcdir if not os.path.isabs(srcdir): srcdir = depth + "/" + srcdir #TODO: should compare with the existing file and not overwrite it if the # contents are the same! ensure_directory_exists(filename) with open(filename, "w") as f: f.write(COMMON_HEADER % {'buildfile': build_file, 'depth': depth, 'topsrcdir': topsrcdir, 'srcdir': srcdir}) for k, v in data.iteritems(): f.write("%s = %s\n" % (k, " \\\n ".join([''] + v) if isinstance(v, list) else v)) - f.write(COMMON_FOOTER % {'relative_path': relative_path}) + f.write(COMMON_FOOTER % {'common_mk_path': common_mk_path}) if extra_data: f.write(extra_data) def WriteCommonMk(path, build_files, scriptname, commandline): with open(path, "w") as f: f.write(COMMON_MK % {'input_gypfiles': ' '.join(build_files), 'generator': scriptname, 'commandline': ' '.join(commandline)}) @@ -193,27 +193,28 @@ def getdepth(s): """Given a relative path, return a relative path consisting of .. segments that would lead to the parent directory.""" return "/".join(".." for x in swapslashes(s).split("/") if x) def Compilable(filename): return os.path.splitext(filename)[1] in COMPILABLE_EXTENSIONS class MakefileGenerator(object): - def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor): + def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor, common_mk_path): self.target_dicts = target_dicts self.data = data self.options = options self.depth = depth self.relative_srcdir = swapslashes(relative_srcdir) self.topsrcdir = swapslashes(topsrcdir) self.relative_topsrcdir = swapslashes(relative_topsrcdir) self.srcdir = swapslashes(os.path.join(topsrcdir, relative_srcdir)) self.output_dir = output_dir self.flavor = flavor + self.common_mk_path = common_mk_path # Directories to be built in order. self.dirs = [] # Directories that can be built in any order, but before |dirs|. self.parallel_dirs = [] # Targets that have been processed. self.visited = set() # Link dependencies. self.target_link_deps = {} @@ -372,17 +373,18 @@ class MakefileGenerator(object): if self.flavor == 'win': top = self.relative_topsrcdir else: top = self.topsrcdir WriteMakefile(output_file, data, build_file, depth, top, # we set srcdir up one directory, since the subdir # doesn't actually exist in the source directory swapslashes(os.path.join(top, self.relative_srcdir, os.path.split(rel_path)[0])), - self.relative_srcdir) + self.relative_srcdir, + self.common_mk_path) return True def GenerateOutput(target_list, target_dicts, data, params): options = params['options'] flavor = GetFlavor(params) generator_flags = params.get('generator_flags', {}) # Get a few directories into Mozilla-common naming conventions @@ -417,34 +419,37 @@ def GenerateOutput(target_list, target_d build_files = set() for build_file in params['build_files']: build_file = os.path.normpath(build_file) for target in gyp.common.AllTargets(target_list, target_dicts, build_file): needed_targets.add(target) build_file_, _, _ = gyp.common.ParseQualifiedTarget(target) build_files.add(topsrcdir_path(build_file_)) - generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor) + common_mk_path = objdir_path(os.path.join(output_dir, "common.mk")) + + generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor, common_mk_path) generator.ProcessTargets(needed_targets) # Write the top-level makefile, which simply calls the other makefiles topdata = {'DIRS': generator.dirs} if generator.parallel_dirs: topdata['PARALLEL_DIRS'] = generator.parallel_dirs if flavor == 'win': top = relative_topsrcdir src = srcdir else: top = topsrcdir src = abs_srcdir WriteMakefile(makefile_path, topdata, params['build_files'][0], depth, swapslashes(top), swapslashes(src), - swapslashes(relative_srcdir)) + swapslashes(relative_srcdir), + common_mk_path) scriptname = "$(topsrcdir)/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py" # Reassemble a commandline from parts so that all the paths are correct # NOTE: this MUST match the commandline generated in configure.in! # since we don't see --include statements, duplicate them in FORCE_INCLUDE_FILE lines # Being in a define, they also get used by the common.mk invocation of gyp so they # they don't disappear in the second round of tail-swallowing forced_includes = "" for option in options.defines: @@ -456,13 +461,13 @@ def GenerateOutput(target_list, target_d forced_includes, "--depth=%s" % topsrcdir_path(options.depth), "--generator-output=%s" % objdir_path(options.generator_output), "--toplevel-dir=$(topsrcdir)", #XXX: handle other generator_flags gracefully? "-G OBJDIR=$(DEPTH)"] + \ ['-D%s' % d for d in options.defines] + \ [topsrcdir_path(b) for b in params['build_files']] - + WriteCommonMk(os.path.join(output_dir, "common.mk"), build_files, scriptname, commandline)