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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 self.WriteLn('LOCAL_MODULE := ' + self.android_module) | 181 self.WriteLn('LOCAL_MODULE := ' + self.android_module) |
182 # Only emit LOCAL_MODULE_STEM if it's different to LOCAL_MODULE. | 182 # Only emit LOCAL_MODULE_STEM if it's different to LOCAL_MODULE. |
183 # The library module classes fail if the stem is set. ComputeOutputParts | 183 # The library module classes fail if the stem is set. ComputeOutputParts |
184 # makes sure that stem == modulename in these cases. | 184 # makes sure that stem == modulename in these cases. |
185 if self.android_stem != self.android_module: | 185 if self.android_stem != self.android_module: |
186 self.WriteLn('LOCAL_MODULE_STEM := ' + self.android_stem) | 186 self.WriteLn('LOCAL_MODULE_STEM := ' + self.android_stem) |
187 self.WriteLn('LOCAL_MODULE_SUFFIX := ' + self.android_suffix) | 187 self.WriteLn('LOCAL_MODULE_SUFFIX := ' + self.android_suffix) |
188 self.WriteLn('LOCAL_MODULE_TAGS := optional') | 188 self.WriteLn('LOCAL_MODULE_TAGS := optional') |
189 if self.toolset == 'host': | 189 if self.toolset == 'host': |
190 self.WriteLn('LOCAL_IS_HOST_MODULE := true') | 190 self.WriteLn('LOCAL_IS_HOST_MODULE := true') |
| 191 self.WriteLn('LOCAL_MULTILIB := $(GYP_HOST_MULTILIB)') |
191 else: | 192 else: |
192 self.WriteLn('LOCAL_MODULE_TARGET_ARCH := ' | 193 self.WriteLn('LOCAL_MODULE_TARGET_ARCH := ' |
193 '$(TARGET_$(GYP_VAR_PREFIX)ARCH)') | 194 '$(TARGET_$(GYP_VAR_PREFIX)ARCH)') |
194 | 195 |
195 # Grab output directories; needed for Actions and Rules. | 196 # Grab output directories; needed for Actions and Rules. |
196 if self.toolset == 'host': | 197 if self.toolset == 'host': |
197 self.WriteLn('gyp_intermediate_dir := ' | 198 self.WriteLn('gyp_intermediate_dir := ' |
198 '$(call local-intermediates-dir)') | 199 '$(call local-intermediates-dir,,$(GYP_HOST_VAR_PREFIX))') |
199 else: | 200 else: |
200 self.WriteLn('gyp_intermediate_dir := ' | 201 self.WriteLn('gyp_intermediate_dir := ' |
201 '$(call local-intermediates-dir,,$(GYP_VAR_PREFIX))') | 202 '$(call local-intermediates-dir,,$(GYP_VAR_PREFIX))') |
202 self.WriteLn('gyp_shared_intermediate_dir := ' | 203 self.WriteLn('gyp_shared_intermediate_dir := ' |
203 '$(call intermediates-dir-for,GYP,shared,,,$(GYP_VAR_PREFIX))') | 204 '$(call intermediates-dir-for,GYP,shared,,,$(GYP_VAR_PREFIX))') |
204 self.WriteLn() | 205 self.WriteLn() |
205 | 206 |
206 # List files this target depends on so that actions/rules/copies/sources | 207 # List files this target depends on so that actions/rules/copies/sources |
207 # can depend on the list. | 208 # can depend on the list. |
208 # TODO: doesn't pull in things through transitive link deps; needed? | 209 # TODO: doesn't pull in things through transitive link deps; needed? |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 688 |
688 E.g., the loadable module 'foobar' in directory 'baz' will produce | 689 E.g., the loadable module 'foobar' in directory 'baz' will produce |
689 '$(obj)/baz/libfoobar.so' | 690 '$(obj)/baz/libfoobar.so' |
690 """ | 691 """ |
691 if self.type == 'executable': | 692 if self.type == 'executable': |
692 # We install host executables into shared_intermediate_dir so they can be | 693 # We install host executables into shared_intermediate_dir so they can be |
693 # run by gyp rules that refer to PRODUCT_DIR. | 694 # run by gyp rules that refer to PRODUCT_DIR. |
694 path = '$(gyp_shared_intermediate_dir)' | 695 path = '$(gyp_shared_intermediate_dir)' |
695 elif self.type == 'shared_library': | 696 elif self.type == 'shared_library': |
696 if self.toolset == 'host': | 697 if self.toolset == 'host': |
697 path = '$(HOST_OUT_INTERMEDIATE_LIBRARIES)' | 698 path = '$($(GYP_HOST_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)' |
698 else: | 699 else: |
699 path = '$($(GYP_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)' | 700 path = '$($(GYP_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)' |
700 else: | 701 else: |
701 # Other targets just get built into their intermediate dir. | 702 # Other targets just get built into their intermediate dir. |
702 if self.toolset == 'host': | 703 if self.toolset == 'host': |
703 path = '$(call intermediates-dir-for,%s,%s,true)' % (self.android_class, | 704 path = ('$(call intermediates-dir-for,%s,%s,true,,' |
704 self.android_module) | 705 '$(GYP_HOST_VAR_PREFIX))' % (self.android_class, |
| 706 self.android_module)) |
705 else: | 707 else: |
706 path = ('$(call intermediates-dir-for,%s,%s,,,$(GYP_VAR_PREFIX))' | 708 path = ('$(call intermediates-dir-for,%s,%s,,,$(GYP_VAR_PREFIX))' |
707 % (self.android_class, self.android_module)) | 709 % (self.android_class, self.android_module)) |
708 | 710 |
709 assert spec.get('product_dir') is None # TODO: not supported? | 711 assert spec.get('product_dir') is None # TODO: not supported? |
710 return os.path.join(path, self.ComputeOutputBasename(spec)) | 712 return os.path.join(path, self.ComputeOutputBasename(spec)) |
711 | 713 |
712 def NormalizeIncludePaths(self, include_paths): | 714 def NormalizeIncludePaths(self, include_paths): |
713 """ Normalize include_paths. | 715 """ Normalize include_paths. |
714 Convert absolute paths to relative to the Android top directory; | 716 Convert absolute paths to relative to the Android top directory; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 elif self.type == 'executable': | 882 elif self.type == 'executable': |
881 # Executables are for build and test purposes only, so they're installed | 883 # Executables are for build and test purposes only, so they're installed |
882 # to a directory that doesn't get included in the system image. | 884 # to a directory that doesn't get included in the system image. |
883 self.WriteLn('LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)') | 885 self.WriteLn('LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)') |
884 self.WriteLn('include $(BUILD_%sEXECUTABLE)' % modifier) | 886 self.WriteLn('include $(BUILD_%sEXECUTABLE)' % modifier) |
885 else: | 887 else: |
886 self.WriteLn('LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp') | 888 self.WriteLn('LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp') |
887 self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true') | 889 self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true') |
888 if self.toolset == 'target': | 890 if self.toolset == 'target': |
889 self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)') | 891 self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)') |
| 892 else: |
| 893 self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)') |
890 self.WriteLn() | 894 self.WriteLn() |
891 self.WriteLn('include $(BUILD_SYSTEM)/base_rules.mk') | 895 self.WriteLn('include $(BUILD_SYSTEM)/base_rules.mk') |
892 self.WriteLn() | 896 self.WriteLn() |
893 self.WriteLn('$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)') | 897 self.WriteLn('$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)') |
894 self.WriteLn('\t$(hide) echo "Gyp timestamp: $@"') | 898 self.WriteLn('\t$(hide) echo "Gyp timestamp: $@"') |
895 self.WriteLn('\t$(hide) mkdir -p $(dir $@)') | 899 self.WriteLn('\t$(hide) mkdir -p $(dir $@)') |
896 self.WriteLn('\t$(hide) touch $@') | 900 self.WriteLn('\t$(hide) touch $@') |
897 if self.toolset == 'target': | 901 self.WriteLn() |
898 self.WriteLn() | 902 self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX :=') |
899 self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX :=') | |
900 | 903 |
901 | 904 |
902 def WriteList(self, value_list, variable=None, prefix='', | 905 def WriteList(self, value_list, variable=None, prefix='', |
903 quoter=make.QuoteIfNecessary, local_pathify=False): | 906 quoter=make.QuoteIfNecessary, local_pathify=False): |
904 """Write a variable definition that is a list of values. | 907 """Write a variable definition that is a list of values. |
905 | 908 |
906 E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out | 909 E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out |
907 foo = blaha blahb | 910 foo = blaha blahb |
908 but in a pretty-printed style. | 911 but in a pretty-printed style. |
909 """ | 912 """ |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 android_modules[android_module] = qualified_target | 1076 android_modules[android_module] = qualified_target |
1074 | 1077 |
1075 # Our root_makefile lives at the source root. Compute the relative path | 1078 # Our root_makefile lives at the source root. Compute the relative path |
1076 # from there to the output_file for including. | 1079 # from there to the output_file for including. |
1077 mkfile_rel_path = gyp.common.RelativePath(output_file, | 1080 mkfile_rel_path = gyp.common.RelativePath(output_file, |
1078 os.path.dirname(makefile_path)) | 1081 os.path.dirname(makefile_path)) |
1079 include_list.add(mkfile_rel_path) | 1082 include_list.add(mkfile_rel_path) |
1080 | 1083 |
1081 root_makefile.write('GYP_CONFIGURATION ?= %s\n' % default_configuration) | 1084 root_makefile.write('GYP_CONFIGURATION ?= %s\n' % default_configuration) |
1082 root_makefile.write('GYP_VAR_PREFIX ?=\n') | 1085 root_makefile.write('GYP_VAR_PREFIX ?=\n') |
| 1086 root_makefile.write('GYP_HOST_VAR_PREFIX ?=\n') |
| 1087 root_makefile.write('GYP_HOST_MULTILIB ?=\n') |
1083 | 1088 |
1084 # Write out the sorted list of includes. | 1089 # Write out the sorted list of includes. |
1085 root_makefile.write('\n') | 1090 root_makefile.write('\n') |
1086 for include_file in sorted(include_list): | 1091 for include_file in sorted(include_list): |
1087 root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') | 1092 root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') |
1088 root_makefile.write('\n') | 1093 root_makefile.write('\n') |
1089 | 1094 |
1090 if write_alias_targets: | 1095 if write_alias_targets: |
1091 root_makefile.write(ALL_MODULES_FOOTER) | 1096 root_makefile.write(ALL_MODULES_FOOTER) |
1092 | 1097 |
1093 root_makefile.close() | 1098 root_makefile.close() |
OLD | NEW |