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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 496 |
497 self.WriteLn('\n# Include paths placed before CFLAGS/CPPFLAGS') | 497 self.WriteLn('\n# Include paths placed before CFLAGS/CPPFLAGS') |
498 includes = list(config.get('include_dirs', [])) | 498 includes = list(config.get('include_dirs', [])) |
499 includes.extend(extracted_includes) | 499 includes.extend(extracted_includes) |
500 includes = map(Sourceify, map(self.LocalPathify, includes)) | 500 includes = map(Sourceify, map(self.LocalPathify, includes)) |
501 includes = self.NormalizeIncludePaths(includes) | 501 includes = self.NormalizeIncludePaths(includes) |
502 self.WriteList(includes, 'LOCAL_C_INCLUDES_%s' % configname) | 502 self.WriteList(includes, 'LOCAL_C_INCLUDES_%s' % configname) |
503 | 503 |
504 self.WriteLn('\n# Flags passed to only C++ (and not C) files.') | 504 self.WriteLn('\n# Flags passed to only C++ (and not C) files.') |
505 self.WriteList(config.get('cflags_cc'), 'LOCAL_CPPFLAGS_%s' % configname) | 505 self.WriteList(config.get('cflags_cc'), 'LOCAL_CPPFLAGS_%s' % configname) |
| 506 if int(config.get('android_enable_fdo', 0)): |
| 507 use_fdo = 'true' |
| 508 else: |
| 509 use_fdo = 'false' |
| 510 self.WriteLn('\nLOCAL_FDO_SUPPORT_%s := %s' % (configname, use_fdo)) |
506 | 511 |
507 self.WriteLn('\nLOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) ' | 512 self.WriteLn('\nLOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) ' |
508 '$(MY_DEFS_$(GYP_CONFIGURATION))') | 513 '$(MY_DEFS_$(GYP_CONFIGURATION))') |
| 514 self.WriteLn( |
| 515 'LOCAL_FDO_SUPPORT := $(LOCAL_FDO_SUPPORT_$(GYP_CONFIGURATION))') |
| 516 |
| 517 self.WriteLn('\nifneq ($(strip $(TARGET_FDO_CFLAGS)),)') |
| 518 self.WriteLn(' ifeq ($(strip $(LOCAL_FDO_SUPPORT)), true)') |
| 519 self.WriteLn( |
| 520 ' LOCAL_CFLAGS := $(patsubst -Os,-O2,$(LOCAL_CFLAGS))') |
| 521 self.WriteLn( |
| 522 ' fdo_incompatible_flags=-fno-early-inlining -finline-limit=%') |
| 523 self.WriteLn( |
| 524 ' LOCAL_CFLAGS := $(filter-out $(fdo_incompatible_flags),' |
| 525 '$(LOCAL_CFLAGS))') |
| 526 self.WriteLn(' endif') |
| 527 self.WriteLn('endif\n') |
| 528 |
509 # Undefine ANDROID for host modules | 529 # Undefine ANDROID for host modules |
510 # TODO: the source code should not use macro ANDROID to tell if it's host | 530 # TODO: the source code should not use macro ANDROID to tell if it's host |
511 # or target module. | 531 # or target module. |
512 if self.toolset == 'host': | 532 if self.toolset == 'host': |
513 self.WriteLn('# Undefine ANDROID for host modules') | 533 self.WriteLn('# Undefine ANDROID for host modules') |
514 self.WriteLn('LOCAL_CFLAGS += -UANDROID') | 534 self.WriteLn('LOCAL_CFLAGS += -UANDROID') |
515 self.WriteLn('LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) ' | 535 self.WriteLn('LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) ' |
516 '$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))') | 536 '$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))') |
517 self.WriteLn('LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))') | 537 self.WriteLn('LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))') |
518 # Android uses separate flags for assembly file invocations, but gyp expects | 538 # Android uses separate flags for assembly file invocations, but gyp expects |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 # Write out the sorted list of includes. | 1109 # Write out the sorted list of includes. |
1090 root_makefile.write('\n') | 1110 root_makefile.write('\n') |
1091 for include_file in sorted(include_list): | 1111 for include_file in sorted(include_list): |
1092 root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') | 1112 root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') |
1093 root_makefile.write('\n') | 1113 root_makefile.write('\n') |
1094 | 1114 |
1095 if write_alias_targets: | 1115 if write_alias_targets: |
1096 root_makefile.write(ALL_MODULES_FOOTER) | 1116 root_makefile.write(ALL_MODULES_FOOTER) |
1097 | 1117 |
1098 root_makefile.close() | 1118 root_makefile.close() |
OLD | NEW |