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 generates makefiles suitable for inclusion into the Android build system | 7 # This generates makefiles suitable for inclusion into the Android build system |
8 # via an Android.mk file. It is based on make.py, the standard makefile | 8 # via an Android.mk file. It is based on make.py, the standard makefile |
9 # generator. | 9 # generator. |
10 # | 10 # |
(...skipping 27 matching lines...) Expand all Loading... | |
38 'RULE_INPUT_PATH': '$(RULE_SOURCES)', | 38 'RULE_INPUT_PATH': '$(RULE_SOURCES)', |
39 'RULE_INPUT_EXT': '$(suffix $<)', | 39 'RULE_INPUT_EXT': '$(suffix $<)', |
40 'RULE_INPUT_NAME': '$(notdir $<)', | 40 'RULE_INPUT_NAME': '$(notdir $<)', |
41 'CONFIGURATION_NAME': 'NOT_USED_ON_ANDROID', | 41 'CONFIGURATION_NAME': 'NOT_USED_ON_ANDROID', |
42 } | 42 } |
43 | 43 |
44 # Make supports multiple toolsets | 44 # Make supports multiple toolsets |
45 generator_supports_multiple_toolsets = True | 45 generator_supports_multiple_toolsets = True |
46 | 46 |
47 | 47 |
48 # Generator-specific gyp specs. | |
49 generator_additional_non_configuration_keys = [ | |
50 # Boolean to declare that this target does not want its name mangled. | |
51 'android_unmangled_name', | |
52 ] | |
53 generator_additional_path_sections = [] | |
54 generator_extra_sources_for_rules = [] | |
55 | |
56 | |
48 SHARED_FOOTER = """\ | 57 SHARED_FOOTER = """\ |
49 # "gyp_all_modules" is a concatenation of the "gyp_all_modules" targets from | 58 # "gyp_all_modules" is a concatenation of the "gyp_all_modules" targets from |
50 # all the included sub-makefiles. This is just here to clarify. | 59 # all the included sub-makefiles. This is just here to clarify. |
51 gyp_all_modules: | 60 gyp_all_modules: |
52 """ | 61 """ |
53 | 62 |
54 header = """\ | 63 header = """\ |
55 # This file is generated by gyp; do not edit. | 64 # This file is generated by gyp; do not edit. |
56 | 65 |
57 """ | 66 """ |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 | 579 |
571 | 580 |
572 def ComputeAndroidModule(self, spec): | 581 def ComputeAndroidModule(self, spec): |
573 """Return the Android module name used for a gyp spec. | 582 """Return the Android module name used for a gyp spec. |
574 | 583 |
575 We use the complete qualified target name to avoid collisions between | 584 We use the complete qualified target name to avoid collisions between |
576 duplicate targets in different directories. We also add a suffix to | 585 duplicate targets in different directories. We also add a suffix to |
577 distinguish gyp-generated module names. | 586 distinguish gyp-generated module names. |
578 """ | 587 """ |
579 | 588 |
589 if spec.get('android_unmangled_name'): | |
Nico
2012/10/15 23:35:13
This is true for targets that say
'android_unma
Torne
2012/10/16 10:34:31
Done.
| |
590 assert self.type != 'shared_library' or self.target.startswith('lib') | |
591 return self.target | |
592 | |
580 if self.type == 'shared_library': | 593 if self.type == 'shared_library': |
581 # For reasons of convention, the Android build system requires that all | 594 # For reasons of convention, the Android build system requires that all |
582 # shared library modules are named 'libfoo' when generating -l flags. | 595 # shared library modules are named 'libfoo' when generating -l flags. |
583 prefix = 'lib_' | 596 prefix = 'lib_' |
584 else: | 597 else: |
585 prefix = '' | 598 prefix = '' |
586 | 599 |
587 if spec['toolset'] == 'host': | 600 if spec['toolset'] == 'host': |
588 suffix = '_host_gyp' | 601 suffix = '_host_gyp' |
589 else: | 602 else: |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 # the Make target 'all' on Android. | 845 # the Make target 'all' on Android. |
833 if part_of_all: | 846 if part_of_all: |
834 self.WriteLn('# Add target alias to "gyp_all_modules" target.') | 847 self.WriteLn('# Add target alias to "gyp_all_modules" target.') |
835 self.WriteLn('.PHONY: gyp_all_modules') | 848 self.WriteLn('.PHONY: gyp_all_modules') |
836 self.WriteLn('gyp_all_modules: %s' % self.android_module) | 849 self.WriteLn('gyp_all_modules: %s' % self.android_module) |
837 self.WriteLn('') | 850 self.WriteLn('') |
838 | 851 |
839 # Add an alias from the gyp target name to the Android module name. This | 852 # Add an alias from the gyp target name to the Android module name. This |
840 # simplifies manual builds of the target, and is required by the test | 853 # simplifies manual builds of the target, and is required by the test |
841 # framework. | 854 # framework. |
842 self.WriteLn('# Alias gyp target name.') | 855 if self.target != self.android_module: |
843 self.WriteLn('.PHONY: %s' % self.target) | 856 self.WriteLn('# Alias gyp target name.') |
844 self.WriteLn('%s: %s' % (self.target, self.android_module)) | 857 self.WriteLn('.PHONY: %s' % self.target) |
845 self.WriteLn('') | 858 self.WriteLn('%s: %s' % (self.target, self.android_module)) |
859 self.WriteLn('') | |
846 | 860 |
847 # Add the command to trigger build of the target type depending | 861 # Add the command to trigger build of the target type depending |
848 # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY | 862 # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY |
849 # NOTE: This has to come last! | 863 # NOTE: This has to come last! |
850 modifier = '' | 864 modifier = '' |
851 if self.toolset == 'host': | 865 if self.toolset == 'host': |
852 modifier = 'HOST_' | 866 modifier = 'HOST_' |
853 if self.type == 'static_library': | 867 if self.type == 'static_library': |
854 self.WriteLn('include $(BUILD_%sSTATIC_LIBRARY)' % modifier) | 868 self.WriteLn('include $(BUILD_%sSTATIC_LIBRARY)' % modifier) |
855 elif self.type == 'shared_library': | 869 elif self.type == 'shared_library': |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1069 for include_file in sorted(include_list): | 1083 for include_file in sorted(include_list): |
1070 root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') | 1084 root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') |
1071 root_makefile.write('\n') | 1085 root_makefile.write('\n') |
1072 | 1086 |
1073 if generator_flags.get('auto_regeneration', True): | 1087 if generator_flags.get('auto_regeneration', True): |
1074 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 1088 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
1075 | 1089 |
1076 root_makefile.write(SHARED_FOOTER) | 1090 root_makefile.write(SHARED_FOOTER) |
1077 | 1091 |
1078 root_makefile.close() | 1092 root_makefile.close() |
OLD | NEW |