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

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: fix test for gyp-win*& 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') | no next file with comments »
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 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'), 1995 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'),
1996 'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'), 1996 'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'),
1997 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'), 1997 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'),
1998 'AR.host': GetEnvironFallback(('AR_host',), 'ar'), 1998 'AR.host': GetEnvironFallback(('AR_host',), 'ar'),
1999 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'), 1999 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'),
2000 'LINK.host': GetEnvironFallback(('LD_host',), 'g++'), 2000 'LINK.host': GetEnvironFallback(('LD_host',), 'g++'),
2001 }) 2001 })
2002 2002
2003 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) 2003 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
2004 make_global_settings_array = data[build_file].get('make_global_settings', []) 2004 make_global_settings_array = data[build_file].get('make_global_settings', [])
2005 wrappers = {}
2006 wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command
2007 for key, value in make_global_settings_array:
2008 if key.endswith('_wrapper'):
2009 wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value
2005 make_global_settings = '' 2010 make_global_settings = ''
2006 for key, value in make_global_settings_array: 2011 for key, value in make_global_settings_array:
2012 if re.match('.*_wrapper', key):
2013 continue
2007 if value[0] != '$': 2014 if value[0] != '$':
2008 value = '$(abspath %s)' % value 2015 value = '$(abspath %s)' % value
2009 if key == 'LINK': 2016 wrapper = wrappers.get(key)
2010 make_global_settings += ('%s ?= %s $(builddir)/linker.lock %s\n' % 2017 if wrapper:
2011 (key, flock_command, value)) 2018 value = '%s %s' % (wrapper, value)
2012 elif key in ('CC', 'CC.host', 'CXX', 'CXX.host'): 2019 del wrappers[key]
2020 if key in ('CC', 'CC.host', 'CXX', 'CXX.host'):
2013 make_global_settings += ( 2021 make_global_settings += (
2014 'ifneq (,$(filter $(origin %s), undefined default))\n' % key) 2022 'ifneq (,$(filter $(origin %s), undefined default))\n' % key)
2015 # Let gyp-time envvars win over global settings. 2023 # Let gyp-time envvars win over global settings.
2016 if key in os.environ: 2024 if key in os.environ:
2017 value = os.environ[key] 2025 value = os.environ[key]
2018 make_global_settings += ' %s = %s\n' % (key, value) 2026 make_global_settings += ' %s = %s\n' % (key, value)
2019 make_global_settings += 'endif\n' 2027 make_global_settings += 'endif\n'
2020 else: 2028 else:
2021 make_global_settings += '%s ?= %s\n' % (key, value) 2029 make_global_settings += '%s ?= %s\n' % (key, value)
2030 # TODO(ukai): define cmd when only wrapper is specified in
2031 # make_global_settings.
2032
2022 header_params['make_global_settings'] = make_global_settings 2033 header_params['make_global_settings'] = make_global_settings
2023 2034
2024 ensure_directory_exists(makefile_path) 2035 ensure_directory_exists(makefile_path)
2025 root_makefile = open(makefile_path, 'w') 2036 root_makefile = open(makefile_path, 'w')
2026 root_makefile.write(SHARED_HEADER % header_params) 2037 root_makefile.write(SHARED_HEADER % header_params)
2027 # Currently any versions have the same effect, but in future the behavior 2038 # Currently any versions have the same effect, but in future the behavior
2028 # could be different. 2039 # could be different.
2029 if android_ndk_version: 2040 if android_ndk_version:
2030 root_makefile.write( 2041 root_makefile.write(
2031 '# Define LOCAL_PATH for build of Android applications.\n' 2042 '# Define LOCAL_PATH for build of Android applications.\n'
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 root_makefile.write("endif\n") 2139 root_makefile.write("endif\n")
2129 root_makefile.write('\n') 2140 root_makefile.write('\n')
2130 2141
2131 if (not generator_flags.get('standalone') 2142 if (not generator_flags.get('standalone')
2132 and generator_flags.get('auto_regeneration', True)): 2143 and generator_flags.get('auto_regeneration', True)):
2133 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) 2144 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files)
2134 2145
2135 root_makefile.write(SHARED_FOOTER) 2146 root_makefile.write(SHARED_FOOTER)
2136 2147
2137 root_makefile.close() 2148 root_makefile.close()
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698