v8: prevent unnecessary rebuilds
Android.mksnapshot.mk is parsed twice when building for a 64-bit device,
for example once for arm64 and again for arm. Using += for
LOCAL_CFLAGS_v8_target_* results in cflags being added twice for the
32-bit version. For a 32-bit device the file is only parsed once and
the cflags are not duplicated.
The cflags are used for host modules, which are shared between builds of
different products. If the cflags change between products the command
line will change and ninja will rebuild all the files.
Replace += with := for the first assignment to LOCAL_CFLAGS_v8_target_*.
Bug: 26470151
FPIIM-449
Change-Id: Idb7bc157830207fe5314b5b084a0bd564d5f3221
diff --git a/Android.mksnapshot.mk b/Android.mksnapshot.mk
index 28e0b0c..74af29b 100644
--- a/Android.mksnapshot.mk
+++ b/Android.mksnapshot.mk
@@ -80,26 +80,26 @@
-Wno-unused-parameter \
-std=gnu++0x
-LOCAL_CFLAGS_v8_target_arm += -DV8_TARGET_ARCH_ARM -O0
-LOCAL_CFLAGS_v8_target_arm64 += -DV8_TARGET_ARCH_ARM64
+LOCAL_CFLAGS_v8_target_arm := -DV8_TARGET_ARCH_ARM -O0
+LOCAL_CFLAGS_v8_target_arm64 := -DV8_TARGET_ARCH_ARM64
ifeq ($(ARCH_ARM_HAVE_VFP),true)
LOCAL_CFLAGS_v8_target_arm += -DCAN_USE_VFP_INSTRUCTIONS -DCAN_USE_ARMV7_INSTRUCTIONS
endif
-LOCAL_CFLAGS_v8_target_mips += -DV8_TARGET_ARCH_MIPS \
+LOCAL_CFLAGS_v8_target_mips := -DV8_TARGET_ARCH_MIPS \
-DCAN_USE_FPU_INSTRUCTIONS \
-Umips \
-finline-limit=64 \
-fno-strict-aliasing
-LOCAL_CFLAGS_v8_target_mips64 += -DV8_TARGET_ARCH_MIPS64 \
+LOCAL_CFLAGS_v8_target_mips64 := -DV8_TARGET_ARCH_MIPS64 \
-Umips \
-finline-limit=64 \
-fno-strict-aliasing
-LOCAL_CFLAGS_v8_target_x86 += -DV8_TARGET_ARCH_IA32
-LOCAL_CFLAGS_v8_target_x86_64 += -DV8_TARGET_ARCH_X64
+LOCAL_CFLAGS_v8_target_x86 := -DV8_TARGET_ARCH_IA32
+LOCAL_CFLAGS_v8_target_x86_64 := -DV8_TARGET_ARCH_X64
ifeq ($(DEBUG_V8),true)
LOCAL_CFLAGS += -DDEBUG -UNDEBUG
@@ -122,6 +122,7 @@
LOCAL_SANITIZE_RECOVER := shift-exponent
include $(BUILD_HOST_EXECUTABLE)
+
else
$(warning mksnapshot.$(mksnapshot_arch): architecture $(mksnapshot_arch) not supported)
endif