Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: pylib/gyp/generator/make.py

Issue 12300015: Support command wrapper in make_global_settings (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | pylib/gyp/generator/ninja.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Notes: 5 # Notes:
6 # 6 #
7 # This is all roughly based on the Makefile system used by the Linux 7 # This is all roughly based on the Makefile system used by the Linux
8 # kernel, but is a non-recursive make -- we put the entire dependency 8 # kernel, but is a non-recursive make -- we put the entire dependency
9 # graph in front of make and let it figure it out. 9 # graph in front of make and let it figure it out.
10 # 10 #
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 'extra_commands': SHARED_HEADER_SUN_COMMANDS, 1992 'extra_commands': SHARED_HEADER_SUN_COMMANDS,
1993 }) 1993 })
1994 elif flavor == 'freebsd': 1994 elif flavor == 'freebsd':
1995 header_params.update({ 1995 header_params.update({
1996 'flock': 'lockf', 1996 'flock': 'lockf',
1997 }) 1997 })
1998 header_params.update(RunSystemTests(flavor)) 1998 header_params.update(RunSystemTests(flavor))
1999 1999
2000 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) 2000 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
2001 make_global_settings_dict = data[build_file].get('make_global_settings', {}) 2001 make_global_settings_dict = data[build_file].get('make_global_settings', {})
2002 wrappers = {}
2003 wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command
2004 for key, value in make_global_settings_dict:
2005 m = re.match('(.*)_wrapper', key)
Nico 2013/02/19 17:21:30 if key.endswith('_wrapper'): wrappers[key[0:len(
ukai 2013/02/20 07:22:53 key[0:len(key)-len('_wrapper')] ?
Nico 2013/02/20 09:12:40 err yes :-)
Sam Clegg 2013/02/20 19:55:20 I think you can just do: key[:-len('_wrapper')]
ukai 2013/02/21 06:41:44 Done.
2006 if m:
2007 wrappers[m.group(1)] = '$(abspath %s)' % value
2002 make_global_settings = '' 2008 make_global_settings = ''
2003 for key, value in make_global_settings_dict: 2009 for key, value in make_global_settings_dict:
2010 if re.match('.*_wrapper', key):
2011 continue
2004 if value[0] != '$': 2012 if value[0] != '$':
2005 value = '$(abspath %s)' % value 2013 value = '$(abspath %s)' % value
2006 if key == 'LINK': 2014 wrapper = wrappers.get(key)
2007 make_global_settings += ('%s ?= %s $(builddir)/linker.lock %s\n' % 2015 if wrapper:
2008 (key, flock_command, value)) 2016 value = '%s %s' % (wrapper, value)
2009 elif key in ['CC', 'CXX']: 2017 del wrappers[key]
2018 if key in ['CC', 'CXX']:
2010 make_global_settings += ( 2019 make_global_settings += (
2011 'ifneq (,$(filter $(origin %s), undefined default))\n' % key) 2020 'ifneq (,$(filter $(origin %s), undefined default))\n' % key)
2012 # Let gyp-time envvars win over global settings. 2021 # Let gyp-time envvars win over global settings.
2013 if key in os.environ: 2022 if key in os.environ:
2014 value = os.environ[key] 2023 value = os.environ[key]
2015 make_global_settings += ' %s = %s\n' % (key, value) 2024 make_global_settings += ' %s = %s\n' % (key, value)
2016 make_global_settings += 'endif\n' 2025 make_global_settings += 'endif\n'
2017 else: 2026 else:
2018 make_global_settings += '%s ?= %s\n' % (key, value) 2027 make_global_settings += '%s ?= %s\n' % (key, value)
2028 # TODO(ukai): define cmd which wrapper only is specified in
Nico 2013/02/19 17:21:30 s/which/when/ s/wrapper only/only wrapper/
ukai 2013/02/20 07:22:53 Done.
2029 # make_global_settings.
2030
2019 header_params['make_global_settings'] = make_global_settings 2031 header_params['make_global_settings'] = make_global_settings
2020 2032
2021 ensure_directory_exists(makefile_path) 2033 ensure_directory_exists(makefile_path)
2022 root_makefile = open(makefile_path, 'w') 2034 root_makefile = open(makefile_path, 'w')
2023 root_makefile.write(SHARED_HEADER % header_params) 2035 root_makefile.write(SHARED_HEADER % header_params)
2024 # Currently any versions have the same effect, but in future the behavior 2036 # Currently any versions have the same effect, but in future the behavior
2025 # could be different. 2037 # could be different.
2026 if android_ndk_version: 2038 if android_ndk_version:
2027 root_makefile.write( 2039 root_makefile.write(
2028 '# Define LOCAL_PATH for build of Android applications.\n' 2040 '# Define LOCAL_PATH for build of Android applications.\n'
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 root_makefile.write(" include " + include_file + "\n") 2136 root_makefile.write(" include " + include_file + "\n")
2125 root_makefile.write("endif\n") 2137 root_makefile.write("endif\n")
2126 root_makefile.write('\n') 2138 root_makefile.write('\n')
2127 2139
2128 if generator_flags.get('auto_regeneration', True): 2140 if generator_flags.get('auto_regeneration', True):
2129 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) 2141 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files)
2130 2142
2131 root_makefile.write(SHARED_FOOTER) 2143 root_makefile.write(SHARED_FOOTER)
2132 2144
2133 root_makefile.close() 2145 root_makefile.close()
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | pylib/gyp/generator/ninja.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698