From 870e44a7b91a5db34123591d2cb99f491a0cb3b1 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 23 Nov 2020 15:58:09 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/47876 Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/acpi/Makefile.inc | 16 +++++---- src/soc/amd/common/block/acpimmio/Makefile.inc | 28 ++++++++------- src/soc/amd/common/block/alink/Makefile.inc | 16 +++++---- src/soc/amd/common/block/gpio_banks/Makefile.inc | 16 +++++---- src/soc/amd/common/block/lpc/Makefile.inc | 34 ++++++++++++------- src/soc/amd/common/block/psp/Makefile.inc | 43 +++++++++++++++--------- src/soc/amd/common/block/spi/Makefile.inc | 8 ++--- 7 files changed, 96 insertions(+), 65 deletions(-) (limited to 'src/soc/amd/common') diff --git a/src/soc/amd/common/block/acpi/Makefile.inc b/src/soc/amd/common/block/acpi/Makefile.inc index f0b336d46d..10e522f064 100644 --- a/src/soc/amd/common/block/acpi/Makefile.inc +++ b/src/soc/amd/common/block/acpi/Makefile.inc @@ -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 diff --git a/src/soc/amd/common/block/acpimmio/Makefile.inc b/src/soc/amd/common/block/acpimmio/Makefile.inc index 553d9e23ca..6b3e423a76 100644 --- a/src/soc/amd/common/block/acpimmio/Makefile.inc +++ b/src/soc/amd/common/block/acpimmio/Makefile.inc @@ -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 diff --git a/src/soc/amd/common/block/alink/Makefile.inc b/src/soc/amd/common/block/alink/Makefile.inc index 9d27aec174..b393c3db13 100644 --- a/src/soc/amd/common/block/alink/Makefile.inc +++ b/src/soc/amd/common/block/alink/Makefile.inc @@ -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 diff --git a/src/soc/amd/common/block/gpio_banks/Makefile.inc b/src/soc/amd/common/block/gpio_banks/Makefile.inc index f1555b12b8..5b738bd371 100644 --- a/src/soc/amd/common/block/gpio_banks/Makefile.inc +++ b/src/soc/amd/common/block/gpio_banks/Makefile.inc @@ -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 diff --git a/src/soc/amd/common/block/lpc/Makefile.inc b/src/soc/amd/common/block/lpc/Makefile.inc index 7db176b31d..68e528ffa2 100644 --- a/src/soc/amd/common/block/lpc/Makefile.inc +++ b/src/soc/amd/common/block/lpc/Makefile.inc @@ -1,13 +1,21 @@ -ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc.c - -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 - -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 +ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC),y) + +ramstage-y += lpc.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 diff --git a/src/soc/amd/common/block/psp/Makefile.inc b/src/soc/amd/common/block/psp/Makefile.inc index c2a33354ad..363a0abb7c 100644 --- a/src/soc/amd/common/block/psp/Makefile.inc +++ b/src/soc/amd/common/block/psp/Makefile.inc @@ -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 - -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 - -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 - -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),y) + +bootblock-y += psp.c +romstage-y += psp.c +ramstage-y += psp.c +smm-y += psp.c +smm-y += psp_smm.c + +endif # CONFIG_SOC_AMD_COMMON_BLOCK_PSP + +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 diff --git a/src/soc/amd/common/block/spi/Makefile.inc b/src/soc/amd/common/block/spi/Makefile.inc index c8b733fe04..c58df39a3d 100644 --- a/src/soc/amd/common/block/spi/Makefile.inc +++ b/src/soc/amd/common/block/spi/Makefile.inc @@ -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 -- cgit v1.2.3