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 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 """Determine where to write a Makefile for a given gyp file.""" | 1944 """Determine where to write a Makefile for a given gyp file.""" |
1945 # Paths in gyp files are relative to the .gyp file, but we want | 1945 # Paths in gyp files are relative to the .gyp file, but we want |
1946 # paths relative to the source root for the master makefile. Grab | 1946 # paths relative to the source root for the master makefile. Grab |
1947 # the path of the .gyp file as the base to relativize against. | 1947 # the path of the .gyp file as the base to relativize against. |
1948 # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". | 1948 # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". |
1949 base_path = gyp.common.RelativePath(os.path.dirname(build_file), | 1949 base_path = gyp.common.RelativePath(os.path.dirname(build_file), |
1950 options.depth) | 1950 options.depth) |
1951 # We write the file in the base_path directory. | 1951 # We write the file in the base_path directory. |
1952 output_file = os.path.join(options.depth, base_path, base_name) | 1952 output_file = os.path.join(options.depth, base_path, base_name) |
1953 if options.generator_output: | 1953 if options.generator_output: |
1954 output_file = os.path.join(options.generator_output, output_file) | 1954 output_file = os.path.join( |
| 1955 options.depth, options.generator_output, base_path, base_name) |
1955 base_path = gyp.common.RelativePath(os.path.dirname(build_file), | 1956 base_path = gyp.common.RelativePath(os.path.dirname(build_file), |
1956 options.toplevel_dir) | 1957 options.toplevel_dir) |
1957 return base_path, output_file | 1958 return base_path, output_file |
1958 | 1959 |
1959 # TODO: search for the first non-'Default' target. This can go | 1960 # TODO: search for the first non-'Default' target. This can go |
1960 # away when we add verification that all targets have the | 1961 # away when we add verification that all targets have the |
1961 # necessary configurations. | 1962 # necessary configurations. |
1962 default_configuration = None | 1963 default_configuration = None |
1963 toolsets = set([target_dicts[target]['toolset'] for target in target_list]) | 1964 toolsets = set([target_dicts[target]['toolset'] for target in target_list]) |
1964 for target in target_list: | 1965 for target in target_list: |
1965 spec = target_dicts[target] | 1966 spec = target_dicts[target] |
1966 if spec['default_configuration'] != 'Default': | 1967 if spec['default_configuration'] != 'Default': |
1967 default_configuration = spec['default_configuration'] | 1968 default_configuration = spec['default_configuration'] |
1968 break | 1969 break |
1969 if not default_configuration: | 1970 if not default_configuration: |
1970 default_configuration = 'Default' | 1971 default_configuration = 'Default' |
1971 | 1972 |
1972 srcdir = '.' | 1973 srcdir = '.' |
1973 makefile_name = 'Makefile' + options.suffix | 1974 makefile_name = 'Makefile' + options.suffix |
1974 makefile_path = os.path.join(options.toplevel_dir, makefile_name) | 1975 makefile_path = os.path.join(options.toplevel_dir, makefile_name) |
1975 if options.generator_output: | 1976 if options.generator_output: |
1976 global srcdir_prefix | 1977 global srcdir_prefix |
1977 makefile_path = os.path.join(options.generator_output, makefile_path) | 1978 makefile_path = os.path.join( |
| 1979 options.toplevel_dir, options.generator_output, makefile_name) |
1978 srcdir = gyp.common.RelativePath(srcdir, options.generator_output) | 1980 srcdir = gyp.common.RelativePath(srcdir, options.generator_output) |
1979 srcdir_prefix = '$(srcdir)/' | 1981 srcdir_prefix = '$(srcdir)/' |
1980 | 1982 |
1981 flock_command= 'flock' | 1983 flock_command= 'flock' |
1982 header_params = { | 1984 header_params = { |
1983 'default_target': default_target, | 1985 'default_target': default_target, |
1984 'builddir': builddir_name, | 1986 'builddir': builddir_name, |
1985 'default_configuration': default_configuration, | 1987 'default_configuration': default_configuration, |
1986 'flock': flock_command, | 1988 'flock': flock_command, |
1987 'flock_index': 1, | 1989 'flock_index': 1, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 root_makefile.write("endif\n") | 2172 root_makefile.write("endif\n") |
2171 root_makefile.write('\n') | 2173 root_makefile.write('\n') |
2172 | 2174 |
2173 if (not generator_flags.get('standalone') | 2175 if (not generator_flags.get('standalone') |
2174 and generator_flags.get('auto_regeneration', True)): | 2176 and generator_flags.get('auto_regeneration', True)): |
2175 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2177 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
2176 | 2178 |
2177 root_makefile.write(SHARED_FOOTER) | 2179 root_makefile.write(SHARED_FOOTER) |
2178 | 2180 |
2179 root_makefile.close() | 2181 root_makefile.close() |
OLD | NEW |