OLD | NEW |
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 # Object output directory. | 239 # Object output directory. |
240 obj := $(builddir)/obj | 240 obj := $(builddir)/obj |
241 abs_obj := $(abspath $(obj)) | 241 abs_obj := $(abspath $(obj)) |
242 | 242 |
243 # We build up a list of every single one of the targets so we can slurp in the | 243 # We build up a list of every single one of the targets so we can slurp in the |
244 # generated dependency rule Makefiles in one pass. | 244 # generated dependency rule Makefiles in one pass. |
245 all_deps := | 245 all_deps := |
246 | 246 |
247 %(make_global_settings)s | 247 %(make_global_settings)s |
248 | 248 |
| 249 CC.target ?= %(CC.target)s |
| 250 CFLAGS.target ?= $(CFLAGS) |
| 251 CXX.target ?= %(CXX.target)s |
| 252 CXXFLAGS.target ?= $(CXXFLAGS) |
| 253 LINK.target ?= %(LINK.target)s |
| 254 LDFLAGS.target ?= $(LDFLAGS) |
| 255 AR.target ?= $(AR) |
| 256 |
249 # C++ apps need to be linked with g++. | 257 # C++ apps need to be linked with g++. |
250 # | 258 # |
251 # Note: flock is used to seralize linking. Linking is a memory-intensive | 259 # Note: flock is used to seralize linking. Linking is a memory-intensive |
252 # process so running parallel links can often lead to thrashing. To disable | 260 # process so running parallel links can often lead to thrashing. To disable |
253 # the serialization, override LINK via an envrionment variable as follows: | 261 # the serialization, override LINK via an envrionment variable as follows: |
254 # | 262 # |
255 # export LINK=g++ | 263 # export LINK=g++ |
256 # | 264 # |
257 # This will allow make to invoke N linker processes as specified in -jN. | 265 # This will allow make to invoke N linker processes as specified in -jN. |
258 LINK ?= %(flock)s $(builddir)/linker.lock $(CXX.target) | 266 LINK ?= %(flock)s $(builddir)/linker.lock $(CXX.target) |
259 | 267 |
260 CC.target ?= %(CC.target)s | |
261 CFLAGS.target ?= $(CFLAGS) | |
262 CXX.target ?= %(CXX.target)s | |
263 CXXFLAGS.target ?= $(CXXFLAGS) | |
264 LINK.target ?= %(LINK.target)s | |
265 LDFLAGS.target ?= $(LDFLAGS) | |
266 AR.target ?= $(AR) | |
267 | |
268 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need | 268 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need |
269 # to replicate this environment fallback in make as well. | 269 # to replicate this environment fallback in make as well. |
270 CC.host ?= %(CC.host)s | 270 CC.host ?= %(CC.host)s |
271 CFLAGS.host ?= | 271 CFLAGS.host ?= |
272 CXX.host ?= %(CXX.host)s | 272 CXX.host ?= %(CXX.host)s |
273 CXXFLAGS.host ?= | 273 CXXFLAGS.host ?= |
274 LINK.host ?= %(LINK.host)s | 274 LINK.host ?= %(LINK.host)s |
275 LDFLAGS.host ?= | 275 LDFLAGS.host ?= |
276 AR.host ?= %(AR.host)s | 276 AR.host ?= %(AR.host)s |
277 | 277 |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 elif flavor == 'freebsd': | 1993 elif flavor == 'freebsd': |
1994 # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific. | 1994 # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific. |
1995 header_params.update({ | 1995 header_params.update({ |
1996 'flock': 'lockf', | 1996 'flock': 'lockf', |
1997 }) | 1997 }) |
1998 | 1998 |
1999 header_params.update({ | 1999 header_params.update({ |
2000 'CC.target': GetEnvironFallback(('CC_target', 'CC'), '$(CC)'), | 2000 'CC.target': GetEnvironFallback(('CC_target', 'CC'), '$(CC)'), |
2001 'AR.target': GetEnvironFallback(('AR_target', 'AR'), '$(AR)'), | 2001 'AR.target': GetEnvironFallback(('AR_target', 'AR'), '$(AR)'), |
2002 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'), | 2002 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'), |
2003 'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'), | 2003 'LINK.target': GetEnvironFallback(('LINK_target', 'LINK'), '$(LINK)'), |
2004 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'), | 2004 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'), |
2005 'AR.host': GetEnvironFallback(('AR_host',), 'ar'), | 2005 'AR.host': GetEnvironFallback(('AR_host',), 'ar'), |
2006 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'), | 2006 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'), |
2007 'LINK.host': GetEnvironFallback(('LD_host',), 'g++'), | 2007 'LINK.host': GetEnvironFallback(('LINK_host',), '$(CXX.host)'), |
2008 }) | 2008 }) |
2009 | 2009 |
2010 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) | 2010 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) |
2011 make_global_settings_array = data[build_file].get('make_global_settings', []) | 2011 make_global_settings_array = data[build_file].get('make_global_settings', []) |
2012 wrappers = {} | 2012 wrappers = {} |
2013 wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command | 2013 wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command |
2014 for key, value in make_global_settings_array: | 2014 for key, value in make_global_settings_array: |
2015 if key.endswith('_wrapper'): | 2015 if key.endswith('_wrapper'): |
2016 wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value | 2016 wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value |
2017 make_global_settings = '' | 2017 make_global_settings = '' |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 root_makefile.write("endif\n") | 2146 root_makefile.write("endif\n") |
2147 root_makefile.write('\n') | 2147 root_makefile.write('\n') |
2148 | 2148 |
2149 if (not generator_flags.get('standalone') | 2149 if (not generator_flags.get('standalone') |
2150 and generator_flags.get('auto_regeneration', True)): | 2150 and generator_flags.get('auto_regeneration', True)): |
2151 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2151 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
2152 | 2152 |
2153 root_makefile.write(SHARED_FOOTER) | 2153 root_makefile.write(SHARED_FOOTER) |
2154 | 2154 |
2155 root_makefile.close() | 2155 root_makefile.close() |
OLD | NEW |