| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Notes: | 7 # Notes: |
| 8 # | 8 # |
| 9 # This is all roughly based on the Makefile system used by the Linux | 9 # This is all roughly based on the Makefile system used by the Linux |
| 10 # kernel, but is a non-recursive make -- we put the entire dependency | 10 # kernel, but is a non-recursive make -- we put the entire dependency |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 @$(cmd_$(1)) | 442 @$(cmd_$(1)) |
| 443 ) | 443 ) |
| 444 @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$
(1)))) > $(depfile) | 444 @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$
(1)))) > $(depfile) |
| 445 @$(if $(2),$(fixup_dep)) | 445 @$(if $(2),$(fixup_dep)) |
| 446 $(if $(and $(3), $(POSTBUILDS)), | 446 $(if $(and $(3), $(POSTBUILDS)), |
| 447 $(call do_postbuilds) | 447 $(call do_postbuilds) |
| 448 ) | 448 ) |
| 449 ) | 449 ) |
| 450 endef | 450 endef |
| 451 | 451 |
| 452 # Declare "all" target first so it is the default, even though we don't have the | 452 # Declare the "%(default_target)s" target first so it is the default, |
| 453 # deps yet. | 453 # even though we don't have the deps yet. |
| 454 .PHONY: all | 454 .PHONY: %(default_target)s |
| 455 all: | 455 %(default_target)s: |
| 456 | 456 |
| 457 # Use FORCE_DO_CMD to force a target to run. Should be coupled with | 457 # Use FORCE_DO_CMD to force a target to run. Should be coupled with |
| 458 # do_cmd. | 458 # do_cmd. |
| 459 .PHONY: FORCE_DO_CMD | 459 .PHONY: FORCE_DO_CMD |
| 460 FORCE_DO_CMD: | 460 FORCE_DO_CMD: |
| 461 | 461 |
| 462 """) | 462 """) |
| 463 | 463 |
| 464 SHARED_HEADER_MAC_COMMANDS = """ | 464 SHARED_HEADER_MAC_COMMANDS = """ |
| 465 quiet_cmd_objc = CXX($(TOOLSET)) $@ | 465 quiet_cmd_objc = CXX($(TOOLSET)) $@ |
| (...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 # Make file executable. | 2717 # Make file executable. |
| 2718 os.chmod(tool_path, 0755) | 2718 os.chmod(tool_path, 0755) |
| 2719 | 2719 |
| 2720 | 2720 |
| 2721 def GenerateOutput(target_list, target_dicts, data, params): | 2721 def GenerateOutput(target_list, target_dicts, data, params): |
| 2722 options = params['options'] | 2722 options = params['options'] |
| 2723 flavor = GetFlavor(params) | 2723 flavor = GetFlavor(params) |
| 2724 generator_flags = params.get('generator_flags', {}) | 2724 generator_flags = params.get('generator_flags', {}) |
| 2725 builddir_name = generator_flags.get('output_dir', 'out') | 2725 builddir_name = generator_flags.get('output_dir', 'out') |
| 2726 android_ndk_version = generator_flags.get('android_ndk_version', None) | 2726 android_ndk_version = generator_flags.get('android_ndk_version', None) |
| 2727 default_target = generator_flags.get('default_target', 'all') |
| 2727 | 2728 |
| 2728 def CalculateMakefilePath(build_file, base_name): | 2729 def CalculateMakefilePath(build_file, base_name): |
| 2729 """Determine where to write a Makefile for a given gyp file.""" | 2730 """Determine where to write a Makefile for a given gyp file.""" |
| 2730 # Paths in gyp files are relative to the .gyp file, but we want | 2731 # Paths in gyp files are relative to the .gyp file, but we want |
| 2731 # paths relative to the source root for the master makefile. Grab | 2732 # paths relative to the source root for the master makefile. Grab |
| 2732 # the path of the .gyp file as the base to relativize against. | 2733 # the path of the .gyp file as the base to relativize against. |
| 2733 # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". | 2734 # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". |
| 2734 base_path = gyp.common.RelativePath(os.path.dirname(build_file), | 2735 base_path = gyp.common.RelativePath(os.path.dirname(build_file), |
| 2735 options.depth) | 2736 options.depth) |
| 2736 # We write the file in the base_path directory. | 2737 # We write the file in the base_path directory. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2758 makefile_name = 'Makefile' + options.suffix | 2759 makefile_name = 'Makefile' + options.suffix |
| 2759 makefile_path = os.path.join(options.toplevel_dir, makefile_name) | 2760 makefile_path = os.path.join(options.toplevel_dir, makefile_name) |
| 2760 if options.generator_output: | 2761 if options.generator_output: |
| 2761 global srcdir_prefix | 2762 global srcdir_prefix |
| 2762 makefile_path = os.path.join(options.generator_output, makefile_path) | 2763 makefile_path = os.path.join(options.generator_output, makefile_path) |
| 2763 srcdir = gyp.common.RelativePath(srcdir, options.generator_output) | 2764 srcdir = gyp.common.RelativePath(srcdir, options.generator_output) |
| 2764 srcdir_prefix = '$(srcdir)/' | 2765 srcdir_prefix = '$(srcdir)/' |
| 2765 | 2766 |
| 2766 flock_command= 'flock' | 2767 flock_command= 'flock' |
| 2767 header_params = { | 2768 header_params = { |
| 2769 'default_target': default_target, |
| 2768 'builddir': builddir_name, | 2770 'builddir': builddir_name, |
| 2769 'default_configuration': default_configuration, | 2771 'default_configuration': default_configuration, |
| 2770 'flock': flock_command, | 2772 'flock': flock_command, |
| 2771 'flock_index': 1, | 2773 'flock_index': 1, |
| 2772 'link_commands': LINK_COMMANDS_LINUX, | 2774 'link_commands': LINK_COMMANDS_LINUX, |
| 2773 'extra_commands': '', | 2775 'extra_commands': '', |
| 2774 'srcdir': srcdir, | 2776 'srcdir': srcdir, |
| 2775 } | 2777 } |
| 2776 if flavor == 'mac': | 2778 if flavor == 'mac': |
| 2777 flock_command = './gyp-mac-tool flock' | 2779 flock_command = './gyp-mac-tool flock' |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2951 # Add a check to make sure we tried to process all the .d files. | 2953 # Add a check to make sure we tried to process all the .d files. |
| 2952 all_deps += """ | 2954 all_deps += """ |
| 2953 ifneq ($(word %(last)d,$(d_files)),) | 2955 ifneq ($(word %(last)d,$(d_files)),) |
| 2954 $(error Found unprocessed dependency files (gyp didn't generate enough rules
!)) | 2956 $(error Found unprocessed dependency files (gyp didn't generate enough rules
!)) |
| 2955 endif | 2957 endif |
| 2956 """ % { 'last': ((num_outputs / 1000) + 1) * 1000 + 1 } | 2958 """ % { 'last': ((num_outputs / 1000) + 1) * 1000 + 1 } |
| 2957 | 2959 |
| 2958 root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps }) | 2960 root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps }) |
| 2959 | 2961 |
| 2960 root_makefile.close() | 2962 root_makefile.close() |
| OLD | NEW |