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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 CC.target ?= %(CC.target)s | 275 CC.target ?= %(CC.target)s |
276 CFLAGS.target ?= $(CFLAGS) | 276 CFLAGS.target ?= $(CFLAGS) |
277 CXX.target ?= %(CXX.target)s | 277 CXX.target ?= %(CXX.target)s |
278 CXXFLAGS.target ?= $(CXXFLAGS) | 278 CXXFLAGS.target ?= $(CXXFLAGS) |
279 LINK.target ?= %(LINK.target)s | 279 LINK.target ?= %(LINK.target)s |
280 LDFLAGS.target ?= $(LDFLAGS) | 280 LDFLAGS.target ?= $(LDFLAGS) |
281 AR.target ?= $(AR) | 281 AR.target ?= $(AR) |
282 | 282 |
283 # C++ apps need to be linked with g++. | 283 # C++ apps need to be linked with g++. |
284 # | 284 LINK ?= $(CXX.target) |
285 # Note: flock is used to seralize linking. Linking is a memory-intensive | |
286 # process so running parallel links can often lead to thrashing. To disable | |
287 # the serialization, override LINK via an envrionment variable as follows: | |
288 # | |
289 # export LINK=g++ | |
290 # | |
291 # This will allow make to invoke N linker processes as specified in -jN. | |
292 LINK ?= %(flock)s $(builddir)/linker.lock $(CXX.target) | |
293 | 285 |
294 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need | 286 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need |
295 # to replicate this environment fallback in make as well. | 287 # to replicate this environment fallback in make as well. |
296 CC.host ?= %(CC.host)s | 288 CC.host ?= %(CC.host)s |
297 CFLAGS.host ?= | 289 CFLAGS.host ?= |
298 CXX.host ?= %(CXX.host)s | 290 CXX.host ?= %(CXX.host)s |
299 CXXFLAGS.host ?= | 291 CXXFLAGS.host ?= |
300 LINK.host ?= %(LINK.host)s | 292 LINK.host ?= %(LINK.host)s |
301 LDFLAGS.host ?= | 293 LDFLAGS.host ?= |
302 AR.host ?= %(AR.host)s | 294 AR.host ?= %(AR.host)s |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 'LINK.target': GetEnvironFallback(('LINK_target', 'LINK'), '$(LINK)'), | 2059 'LINK.target': GetEnvironFallback(('LINK_target', 'LINK'), '$(LINK)'), |
2068 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'), | 2060 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'), |
2069 'AR.host': GetEnvironFallback(('AR_host',), 'ar'), | 2061 'AR.host': GetEnvironFallback(('AR_host',), 'ar'), |
2070 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'), | 2062 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'), |
2071 'LINK.host': GetEnvironFallback(('LINK_host',), '$(CXX.host)'), | 2063 'LINK.host': GetEnvironFallback(('LINK_host',), '$(CXX.host)'), |
2072 }) | 2064 }) |
2073 | 2065 |
2074 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) | 2066 build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) |
2075 make_global_settings_array = data[build_file].get('make_global_settings', []) | 2067 make_global_settings_array = data[build_file].get('make_global_settings', []) |
2076 wrappers = {} | 2068 wrappers = {} |
2077 wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command | |
2078 for key, value in make_global_settings_array: | 2069 for key, value in make_global_settings_array: |
2079 if key.endswith('_wrapper'): | 2070 if key.endswith('_wrapper'): |
2080 wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value | 2071 wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value |
2081 make_global_settings = '' | 2072 make_global_settings = '' |
2082 for key, value in make_global_settings_array: | 2073 for key, value in make_global_settings_array: |
2083 if re.match('.*_wrapper', key): | 2074 if re.match('.*_wrapper', key): |
2084 continue | 2075 continue |
2085 if value[0] != '$': | 2076 if value[0] != '$': |
2086 value = '$(abspath %s)' % value | 2077 value = '$(abspath %s)' % value |
2087 wrapper = wrappers.get(key) | 2078 wrapper = wrappers.get(key) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 root_makefile.write("endif\n") | 2203 root_makefile.write("endif\n") |
2213 root_makefile.write('\n') | 2204 root_makefile.write('\n') |
2214 | 2205 |
2215 if (not generator_flags.get('standalone') | 2206 if (not generator_flags.get('standalone') |
2216 and generator_flags.get('auto_regeneration', True)): | 2207 and generator_flags.get('auto_regeneration', True)): |
2217 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2208 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
2218 | 2209 |
2219 root_makefile.write(SHARED_FOOTER) | 2210 root_makefile.write(SHARED_FOOTER) |
2220 | 2211 |
2221 root_makefile.close() | 2212 root_makefile.close() |
OLD | NEW |