Trim spaces in the rule actions
When rule action contains something like
cp $(FOO) ...
and FOO is set with
FOO := a \
b \
the generated Ninja file constains extra spaces, making it
difficult to compare it to the same file generated by the
Starlark-based product configuration.
Bug: 181797530
Test: manual
Change-Id: I278bd8edf0f017a31c5b5115b2a38f4f663c55fc
diff --git a/core/Makefile b/core/Makefile
index a7df61f..1ab0fe5 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -206,7 +206,7 @@
@mkdir -p $(dir $@)
$(hide) grep -v "$(subst $(space),\|,$(strip \
$(sdk_build_prop_remove)))" $< > $@.tmp
- $(hide) for x in $(sdk_build_prop_remove); do \
+ $(hide) for x in $(strip $(sdk_build_prop_remove)); do \
echo "$$x"generic >> $@.tmp; done
$(hide) mv $@.tmp $@
@@ -320,11 +320,11 @@
define build-image-kernel-modules-depmod
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: .KATI_IMPLICIT_OUTPUTS := $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.alias $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(DEPMOD)
-$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(1)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(strip $(1))
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MOUNT_POINT := $(2)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_DIR := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules/$(8)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_STAGING_DIR := $(3)
-$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_MODULES := $(4)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_MODULES := $(strip $(4))
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_FILE := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_ARCHIVE := $(6)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_OUTPUT_DIR := $(7)
@@ -5148,10 +5148,10 @@
ifeq ($(AB_OTA_UPDATER),true)
@# When using the A/B updater, include the updater config files in the zip.
$(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
- $(hide) for part in $(AB_OTA_PARTITIONS); do \
+ $(hide) for part in $(strip $(AB_OTA_PARTITIONS)); do \
echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
done
- $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
+ $(hide) for conf in $(strip $(AB_OTA_POSTINSTALL_CONFIG)); do \
echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
done
ifdef OSRELEASED_DIRECTORY
@@ -5948,7 +5948,7 @@
$(INTERNAL_SDK_TARGET): $(deps)
@echo "Package SDK: $@"
$(hide) rm -rf $(PRIVATE_DIR) $@
- $(hide) for f in $(target_gnu_MODULES); do \
+ $(hide) for f in $(strip $(target_gnu_MODULES)); do \
if [ -f $$f ]; then \
echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
including GNU target $$f >&2; \
diff --git a/core/main.mk b/core/main.mk
index 21f4387..cb97503 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -355,7 +355,7 @@
ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)
ifeq ($(AB_OTA_UPDATER),true)
-ADDITIONAL_PRODUCT_PROPERTIES += ro.product.ab_ota_partitions=$(subst $(space),$(comma),$(AB_OTA_PARTITIONS))
+ADDITIONAL_PRODUCT_PROPERTIES += ro.product.ab_ota_partitions=$(subst $(space),$(comma),$(strip $(AB_OTA_PARTITIONS)))
endif
# -----------------------------------------------------------------