aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen2019-01-10 15:10:17 -0600
committerDan Willemsen2019-01-10 15:10:17 -0600
commite24da82ffd6f1dfcb2452022b28e21c9b34ddeaa (patch)
tree686259c306480fe163907c4b4179720821f999f8
parent1951e7041644a350ffc80be9ff5754918cf4b5a3 (diff)
downloadplatform-build-e24da82ffd6f1dfcb2452022b28e21c9b34ddeaa.tar.gz
platform-build-e24da82ffd6f1dfcb2452022b28e21c9b34ddeaa.tar.xz
platform-build-e24da82ffd6f1dfcb2452022b28e21c9b34ddeaa.zip
Reorder binary.mk to move LOCAL_INTERMEDIATE_TARGETS later
I'll be adding more intermediate targets in this file, so move all of the uses closer to the end. Bug: 122637600 Test: build-aosp_arm64.ninja is the same before and after Change-Id: Ib8a588e570cb2a61bab75118db6e480d6afceaa8
-rw-r--r--core/binary.mk276
1 files changed, 138 insertions, 138 deletions
diff --git a/core/binary.mk b/core/binary.mk
index e7b0c52d6..cbf2f01d4 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -72,6 +72,9 @@ endif
72else 72else
73 my_native_coverage := false 73 my_native_coverage := false
74endif 74endif
75ifneq ($(NATIVE_COVERAGE),true)
76 my_native_coverage := false
77endif
75 78
76ifeq ($(strip $(ENABLE_XOM)),true) 79ifeq ($(strip $(ENABLE_XOM)),true)
77 ifndef LOCAL_IS_HOST_MODULE 80 ifndef LOCAL_IS_HOST_MODULE
@@ -470,144 +473,6 @@ endif
470my_asflags += -D__ASSEMBLY__ 473my_asflags += -D__ASSEMBLY__
471 474
472########################################################### 475###########################################################
473## Define PRIVATE_ variables from global vars
474###########################################################
475ifndef LOCAL_IS_HOST_MODULE
476ifdef LOCAL_USE_VNDK
477my_target_global_c_includes := \
478 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
479my_target_global_c_system_includes := \
480 $(TARGET_OUT_HEADERS) \
481 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES)
482else ifdef LOCAL_SDK_VERSION
483my_target_global_c_includes :=
484my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
485else ifdef BOARD_VNDK_VERSION
486my_target_global_c_includes := $(SRC_HEADERS) \
487 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
488 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
489my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
490 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
491 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
492else
493my_target_global_c_includes := $(SRC_HEADERS) \
494 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
495 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
496my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
497 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
498 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
499endif
500
501my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
502my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
503my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
504ifeq ($(my_use_clang_lld),true)
505 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
506 include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
507 ifeq ($(my_pack_module_relocations),false)
508 my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
509 endif
510else
511 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
512endif # my_use_clang_lld
513
514$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
515$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes)
516$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
517$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
518$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
519$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
520
521else # LOCAL_IS_HOST_MODULE
522
523my_host_global_c_includes := $(SRC_HEADERS) \
524 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
525my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
526 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
527
528my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
529my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
530my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
531ifeq ($(my_use_clang_lld),true)
532 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
533else
534 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
535endif # my_use_clang_lld
536
537$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes)
538$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes)
539$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
540$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
541$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
542$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
543endif # LOCAL_IS_HOST_MODULE
544
545# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
546# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
547# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
548# clean build of your module after toggling it.
549ifeq ($(NATIVE_COVERAGE),true)
550 ifeq ($(my_native_coverage),true)
551 # Note that clang coverage doesn't play nicely with acov out of the box.
552 # Clang apparently generates .gcno files that aren't compatible with
553 # gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov
554 # with `--gcov-tool /usr/bin/gcov-4.6`.
555 #
556 # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
557 my_cflags += --coverage -O0
558 my_ldflags += --coverage
559 endif
560
561 my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
562
563 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
564 $(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib)
565else
566 my_native_coverage := false
567endif
568
569###########################################################
570## Define PRIVATE_ variables used by multiple module types
571###########################################################
572$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
573 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
574
575ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
576 LOCAL_NO_STATIC_ANALYZER := true
577endif
578
579ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
580 my_syntax_arch := host
581else
582 my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
583endif
584
585ifeq ($(strip $(my_cc)),)
586 my_cc := $(my_cc_wrapper) $(CLANG)
587endif
588
589SYNTAX_TOOLS_PREFIX := \
590 $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
591
592ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
593 my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
594 $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
595endif
596
597$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
598
599ifeq ($(strip $(my_cxx)),)
600 my_cxx := $(my_cxx_wrapper) $(CLANG_CXX)
601endif
602
603ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
604 my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
605 $(SYNTAX_TOOLS_PREFIX)/c++-analyzer
606endif
607
608$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
609$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
610
611# TODO: support a mix of standard extensions so that this isn't necessary 476# TODO: support a mix of standard extensions so that this isn't necessary
612LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) 477LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
613ifeq ($(LOCAL_CPP_EXTENSION),) 478ifeq ($(LOCAL_CPP_EXTENSION),)
@@ -1736,6 +1601,141 @@ endif
1736# (start-group/end-group), so append after the check above. 1601# (start-group/end-group), so append after the check above.
1737my_ldlibs += $(my_cxx_ldlibs) 1602my_ldlibs += $(my_cxx_ldlibs)
1738 1603
1604###########################################################
1605## Define PRIVATE_ variables from global vars
1606###########################################################
1607ifndef LOCAL_IS_HOST_MODULE
1608ifdef LOCAL_USE_VNDK
1609my_target_global_c_includes := \
1610 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
1611my_target_global_c_system_includes := \
1612 $(TARGET_OUT_HEADERS) \
1613 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES)
1614else ifdef LOCAL_SDK_VERSION
1615my_target_global_c_includes :=
1616my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
1617else ifdef BOARD_VNDK_VERSION
1618my_target_global_c_includes := $(SRC_HEADERS) \
1619 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
1620 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
1621my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
1622 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
1623 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
1624else
1625my_target_global_c_includes := $(SRC_HEADERS) \
1626 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
1627 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
1628my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
1629 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
1630 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
1631endif
1632
1633my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
1634my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
1635my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
1636ifeq ($(my_use_clang_lld),true)
1637 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
1638 include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
1639 ifeq ($(my_pack_module_relocations),false)
1640 my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
1641 endif
1642else
1643 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
1644endif # my_use_clang_lld
1645
1646$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
1647$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes)
1648$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
1649$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
1650$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
1651$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
1652
1653else # LOCAL_IS_HOST_MODULE
1654
1655my_host_global_c_includes := $(SRC_HEADERS) \
1656 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
1657my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
1658 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
1659
1660my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
1661my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
1662my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
1663ifeq ($(my_use_clang_lld),true)
1664 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
1665else
1666 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
1667endif # my_use_clang_lld
1668
1669$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes)
1670$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes)
1671$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
1672$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
1673$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
1674$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
1675endif # LOCAL_IS_HOST_MODULE
1676
1677# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
1678# build with NATIVE_COVERAGE=true in your enviornment.
1679ifeq ($(NATIVE_COVERAGE),true)
1680 ifeq ($(my_native_coverage),true)
1681 # Note that clang coverage doesn't play nicely with acov out of the box.
1682 # Clang apparently generates .gcno files that aren't compatible with
1683 # gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov
1684 # with `--gcov-tool /usr/bin/gcov-4.6`.
1685 #
1686 # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
1687 my_cflags += --coverage -O0
1688 my_ldflags += --coverage
1689 endif
1690
1691 my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
1692
1693 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
1694 $(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib)
1695endif
1696
1697###########################################################
1698## Define PRIVATE_ variables used by multiple module types
1699###########################################################
1700$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
1701 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
1702
1703ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
1704 LOCAL_NO_STATIC_ANALYZER := true
1705endif
1706
1707ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
1708 my_syntax_arch := host
1709else
1710 my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
1711endif
1712
1713ifeq ($(strip $(my_cc)),)
1714 my_cc := $(my_cc_wrapper) $(CLANG)
1715endif
1716
1717SYNTAX_TOOLS_PREFIX := \
1718 $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
1719
1720ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
1721 my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
1722 $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
1723endif
1724
1725$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
1726
1727ifeq ($(strip $(my_cxx)),)
1728 my_cxx := $(my_cxx_wrapper) $(CLANG_CXX)
1729endif
1730
1731ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
1732 my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
1733 $(SYNTAX_TOOLS_PREFIX)/c++-analyzer
1734endif
1735
1736$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
1737$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
1738
1739$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) 1739$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
1740$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) 1740$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
1741$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags) 1741$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)