| OLD | NEW |
| 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 # |
| 11 # The code below generates a separate .mk file for each target, but | 11 # The code below generates a separate .mk file for each target, but |
| 12 # all are sourced by the top-level Makefile. This means that all | 12 # all are sourced by the top-level Makefile. This means that all |
| 13 # variables in .mk-files clobber one another. Be careful to use := | 13 # variables in .mk-files clobber one another. Be careful to use := |
| 14 # where appropriate for immediate evaluation, and similarly to watch | 14 # where appropriate for immediate evaluation, and similarly to watch |
| 15 # that you're not relying on a variable value to last beween different | 15 # that you're not relying on a variable value to last beween different |
| 16 # .mk files. | 16 # .mk files. |
| 17 # | 17 # |
| 18 # TODOs: | 18 # TODOs: |
| 19 # | 19 # |
| 20 # Global settings and utility functions are currently stuffed in the | 20 # Global settings and utility functions are currently stuffed in the |
| 21 # toplevel Makefile. It may make sense to generate some .mk files on | 21 # toplevel Makefile. It may make sense to generate some .mk files on |
| 22 # the side to keep the the files readable. | 22 # the side to keep the the files readable. |
| 23 | 23 |
| 24 import os | 24 import os |
| 25 import re | 25 import re |
| 26 import sys | 26 import sys |
| 27 import subprocess |
| 27 import gyp | 28 import gyp |
| 28 import gyp.common | 29 import gyp.common |
| 29 import gyp.system_test | 30 import gyp.system_test |
| 30 import gyp.xcode_emulation | 31 import gyp.xcode_emulation |
| 31 from gyp.common import GetEnvironFallback | 32 from gyp.common import GetEnvironFallback |
| 32 | 33 |
| 33 generator_default_variables = { | 34 generator_default_variables = { |
| 34 'EXECUTABLE_PREFIX': '', | 35 'EXECUTABLE_PREFIX': '', |
| 35 'EXECUTABLE_SUFFIX': '', | 36 'EXECUTABLE_SUFFIX': '', |
| 36 'STATIC_LIB_PREFIX': 'lib', | 37 'STATIC_LIB_PREFIX': 'lib', |
| (...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 # while CC_target defaults to 'cc', so the commands really are different | 1930 # while CC_target defaults to 'cc', so the commands really are different |
| 1930 # even though they're nearly guaranteed to run the same code underneath. | 1931 # even though they're nearly guaranteed to run the same code underneath. |
| 1931 if flavor != 'mac' and gyp.system_test.TestArSupportsT(ar_command=ar_host, | 1932 if flavor != 'mac' and gyp.system_test.TestArSupportsT(ar_command=ar_host, |
| 1932 cc_command=cc_host): | 1933 cc_command=cc_host): |
| 1933 arflags_host = 'crsT' | 1934 arflags_host = 'crsT' |
| 1934 | 1935 |
| 1935 return { 'ARFLAGS.target': arflags_target, | 1936 return { 'ARFLAGS.target': arflags_target, |
| 1936 'ARFLAGS.host': arflags_host } | 1937 'ARFLAGS.host': arflags_host } |
| 1937 | 1938 |
| 1938 | 1939 |
| 1940 def PerformBuild(data, configurations, params): |
| 1941 options = params['options'] |
| 1942 for config in configurations: |
| 1943 arguments = ['make'] |
| 1944 if options.toplevel_dir and options.toplevel_dir != '.': |
| 1945 arguments += '-C', options.toplevel_dir |
| 1946 arguments.append('BUILDTYPE=' + config) |
| 1947 print 'Building [%s]: %s' % (config, arguments) |
| 1948 subprocess.check_call(arguments) |
| 1949 |
| 1950 |
| 1939 def GenerateOutput(target_list, target_dicts, data, params): | 1951 def GenerateOutput(target_list, target_dicts, data, params): |
| 1940 options = params['options'] | 1952 options = params['options'] |
| 1941 flavor = gyp.common.GetFlavor(params) | 1953 flavor = gyp.common.GetFlavor(params) |
| 1942 generator_flags = params.get('generator_flags', {}) | 1954 generator_flags = params.get('generator_flags', {}) |
| 1943 builddir_name = generator_flags.get('output_dir', 'out') | 1955 builddir_name = generator_flags.get('output_dir', 'out') |
| 1944 android_ndk_version = generator_flags.get('android_ndk_version', None) | 1956 android_ndk_version = generator_flags.get('android_ndk_version', None) |
| 1945 default_target = generator_flags.get('default_target', 'all') | 1957 default_target = generator_flags.get('default_target', 'all') |
| 1946 | 1958 |
| 1947 def CalculateMakefilePath(build_file, base_name): | 1959 def CalculateMakefilePath(build_file, base_name): |
| 1948 """Determine where to write a Makefile for a given gyp file.""" | 1960 """Determine where to write a Makefile for a given gyp file.""" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 root_makefile.write("endif\n") | 2168 root_makefile.write("endif\n") |
| 2157 root_makefile.write('\n') | 2169 root_makefile.write('\n') |
| 2158 | 2170 |
| 2159 if (not generator_flags.get('standalone') | 2171 if (not generator_flags.get('standalone') |
| 2160 and generator_flags.get('auto_regeneration', True)): | 2172 and generator_flags.get('auto_regeneration', True)): |
| 2161 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2173 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
| 2162 | 2174 |
| 2163 root_makefile.write(SHARED_FOOTER) | 2175 root_makefile.write(SHARED_FOOTER) |
| 2164 | 2176 |
| 2165 root_makefile.close() | 2177 root_makefile.close() |
| OLD | NEW |