soc/amd/common: simplify conditionals in Makefiles

If there are multiple statements that are conditional on the same
Kconfig option, group them and move the condition check around the
statement. If there's only one statement depending on one condition, use
the short form instead.

Change-Id: I89cb17954150c146ffc762d8cb2e3b3b374924de
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47876
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2020-11-23 15:58:09 +01:00 committed by Patrick Georgi
parent 63d36bc733
commit 870e44a7b9
7 changed files with 91 additions and 60 deletions

View File

@ -1,6 +1,10 @@
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
verstage_x86-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI),y)
bootblock-y += acpi.c
verstage_x86-y += acpi.c
romstage-y += acpi.c
ramstage-y += acpi.c
postcar-y += acpi.c
smm-y += acpi.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_ACPI

View File

@ -1,13 +1,17 @@
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += mmio_util.c
verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += mmio_util.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += mmio_util.c
postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += mmio_util.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += mmio_util.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += mmio_util.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO),y)
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += biosram.c
verstage_x86-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += biosram.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += biosram.c
postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += biosram.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += biosram.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO) += biosram.c
bootblock-y += mmio_util.c
verstage-y += mmio_util.c
romstage-y += mmio_util.c
postcar-y += mmio_util.c
ramstage-y += mmio_util.c
smm-y += mmio_util.c
bootblock-y += biosram.c
verstage_x86-y += biosram.c
romstage-y += biosram.c
postcar-y += biosram.c
ramstage-y += biosram.c
smm-y += biosram.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_ACPIMMIO

View File

@ -1,6 +1,10 @@
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
verstage_x86-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK),y)
bootblock-y += alink.c
verstage_x86-y += alink.c
romstage-y += alink.c
postcar-y += alink.c
ramstage-y += alink.c
smm-y += alink.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_ALINK

View File

@ -1,6 +1,10 @@
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS),y)
bootblock-y += gpio.c
verstage-y += gpio.c
romstage-y += gpio.c
postcar-y += gpio.c
ramstage-y += gpio.c
smm-y += gpio.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS

View File

@ -1,13 +1,21 @@
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC),y)
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
ramstage-y += lpc.c
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_USE_ESPI) += espi_util.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_USE_ESPI) += espi_util.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_USE_ESPI) += espi_util.c
verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_USE_ESPI) += espi_util.c
bootblock-y += lpc_util.c
verstage-y += lpc_util.c
romstage-y += lpc_util.c
postcar-y += lpc_util.c
ramstage-y += lpc_util.c
smm-y += lpc_util.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_LPC
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_USE_ESPI),y)
bootblock-y += espi_util.c
romstage-y += espi_util.c
ramstage-y += espi_util.c
verstage-y += espi_util.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_USE_ESPI

View File

@ -1,16 +1,27 @@
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP) += psp.c
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1) += psp_gen1.c
bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN2) += psp_gen2.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_PSP),y)
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP) += psp.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1) += psp_gen1.c
romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN2) += psp_gen2.c
bootblock-y += psp.c
romstage-y += psp.c
ramstage-y += psp.c
smm-y += psp.c
smm-y += psp_smm.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP) += psp.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1) += psp_gen1.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN2) += psp_gen2.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_PSP
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP) += psp.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP) += psp_smm.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1) += psp_gen1.c
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN2) += psp_gen2.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1),y)
bootblock-y += psp_gen1.c
romstage-y += psp_gen1.c
ramstage-y += psp_gen1.c
smm-y += psp_gen1.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN2),y)
bootblock-y += psp_gen2.c
romstage-y += psp_gen2.c
ramstage-y += psp_gen2.c
smm-y += psp_gen2.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN2

View File

@ -5,18 +5,14 @@ romstage-y += fch_spi_ctrl.c
verstage-y += fch_spi_ctrl.c
postcar-y += fch_spi_ctrl.c
ramstage-y += fch_spi_ctrl.c
ifeq ($(CONFIG_SPI_FLASH_SMM),y)
smm-y += fch_spi_ctrl.c
endif
smm-$(CONFIG_SPI_FLASH_SMM) += fch_spi_ctrl.c
bootblock-y += fch_spi.c
romstage-y += fch_spi.c
postcar-y += fch_spi.c
ramstage-y += fch_spi.c
verstage-y += fch_spi.c
ifeq ($(CONFIG_SPI_FLASH_SMM),y)
smm-y += fch_spi.c
endif
smm-$(CONFIG_SPI_FLASH_SMM) += fch_spi.c
bootblock-y += fch_spi_util.c
romstage-y += fch_spi_util.c