Thomas Heijligen has uploaded this change for review.

View Change

Makefile: use HAS_ USE_ pattern for serial support

Align the usage of serial function with the selection of other
dependencies.

Change-Id: Ica951e76d6362b01f09d23a729a2a6049e7f0b66
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
---
M Makefile
1 file changed, 7 insertions(+), 12 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/96/62196/1
diff --git a/Makefile b/Makefile
index 87f1098..8502552 100644
--- a/Makefile
+++ b/Makefile
@@ -242,14 +242,13 @@
HAS_LINUX_MTD := $(call c_compile_test, Makefile.d/linux_mtd_test.c)
HAS_LINUX_SPI := $(call c_compile_test, Makefile.d/linux_spi_test.c)
HAS_LINUX_I2C := $(call c_compile_test, Makefile.d/linux_i2c_test.c)
+HAS_SERIAL := $(strip $(if $(filter $(TARGET_OS), DOS libpayload), no, yes))
EXEC_SUFFIX := $(strip $(if $(filter $(TARGET_OS), DOS MinGW), .exe))

ifeq ($(TARGET_OS), DOS)
# DJGPP has odd uint*_t definitions which cause lots of format string warnings.
override CFLAGS += -Wno-format
override LDFLAGS += -lgetopt
-# Missing serial support.
-$(call mark_unsupported,$(DEPENDS_ON_SERIAL))
endif

ifeq ($(TARGET_OS), $(filter $(TARGET_OS), MinGW Cygwin))
@@ -287,8 +286,6 @@
$(call mark_unsupported,CONFIG_DUMMY)
# libpayload does not provide the romsize field in struct pci_dev that the atapromise code requires.
$(call mark_unsupported,CONFIG_ATAPROMISE)
-# Bus Pirate, Serprog and PonyProg are not supported with libpayload (missing serial support).
-$(call mark_unsupported,$(DEPENDS_ON_SERIAL))
# Dediprog, Developerbox, USB-Blaster, PICkit2, CH341A and FT2232 are not supported with libpayload (missing libusb support).
$(call mark_unsupported,$(DEPENDS_ON_LIBUSB1) $(DEPENDS_ON_LIBFTDI) $(DEPENDS_ON_LIBJAYLINK))
endif
@@ -335,6 +332,10 @@
$(call mark_unsupported,$(DEPENDS_ON_LIBUSB1))
endif

+ifeq ($(HAS_SERIAL), no)
+$(call mark_unsupported, $(DEPENDS_ON_SERIAL))
+endif
+
ifeq ($(ENDIAN), little)
FEATURE_FLAGS += -D'__FLASHROM_LITTLE_ENDIAN__=1'
endif
@@ -600,8 +601,6 @@
ifeq ($(CONFIG_SERPROG), yes)
FEATURE_FLAGS += -D'CONFIG_SERPROG=1'
PROGRAMMER_OBJS += serprog.o
-NEED_SERIAL += CONFIG_SERPROG
-NEED_POSIX_SOCKETS += CONFIG_SERPROG
endif

ifeq ($(CONFIG_RAYER_SPI), yes)
@@ -617,7 +616,6 @@
ifeq ($(CONFIG_PONY_SPI), yes)
FEATURE_FLAGS += -D'CONFIG_PONY_SPI=1'
PROGRAMMER_OBJS += pony_spi.o
-NEED_SERIAL += CONFIG_PONY_SPI
endif

ifeq ($(CONFIG_BITBANG_SPI), yes)
@@ -738,7 +736,6 @@
ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
FEATURE_FLAGS += -D'CONFIG_BUSPIRATE_SPI=1'
PROGRAMMER_OBJS += buspirate_spi.o
-NEED_SERIAL += CONFIG_BUSPIRATE_SPI
endif

ifeq ($(CONFIG_DEDIPROG), yes)
@@ -795,16 +792,14 @@
LIB_OBJS += i2c_helper_linux.o
endif

-ifneq ($(NEED_SERIAL), )
+USE_SERIAL := $(if $(call filter_deps,$(DEPENDS_ON_SERIAL)),yes,no)
+ifeq ($(USE_SERIAL), yes)
LIB_OBJS += serial.o
ifeq ($(TARGET_OS), Linux)
LIB_OBJS += custom_baud_linux.o
else
LIB_OBJS += custom_baud.o
endif
-endif
-
-ifneq ($(NEED_POSIX_SOCKETS), )
ifeq ($(TARGET_OS), SunOS)
override LDFLAGS += -lsocket -lnsl
endif

To view, visit change 62196. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ica951e76d6362b01f09d23a729a2a6049e7f0b66
Gerrit-Change-Number: 62196
Gerrit-PatchSet: 1
Gerrit-Owner: Thomas Heijligen <src@posteo.de>
Gerrit-MessageType: newchange