diff options
author | Thomas Heijligen <thomas.heijligen@secunet.com> | 2022-01-31 23:49:44 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2022-02-15 00:02:01 +0000 |
commit | 274e146621a22f3de4790e685226e1a87bdca51b (patch) | |
tree | aa1cd1913cdcf08fff41fbd715c9cbff2a0d3a60 /Makefile | |
parent | 9fb5812896859f5e195527d64554e44eb981eac3 (diff) | |
download | flashrom-274e146621a22f3de4790e685226e1a87bdca51b.tar.gz flashrom-274e146621a22f3de4790e685226e1a87bdca51b.tar.bz2 flashrom-274e146621a22f3de4790e685226e1a87bdca51b.zip |
Makefile: check if librt is an external library
Some systems, e.g. OpenBSD, have clock_gettime / librt build into the
libc and therefore fail to link against it with -lrt. Thus, detect this
and link only if needed.
Change-Id: I2c1668a350aa0806fccfb4e9cd8b04861f085ee9
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/61523
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -239,6 +239,7 @@ HAS_PCI_OLD_GET_DEV := $(call c_compile_test, Makefile.d/pci_old_get_dev_test.c, HAS_FT232H := $(call c_compile_test, Makefile.d/ft232h_test.c, $(CONFIG_LIBFTDI1_CFLAGS)) HAS_UTSNAME := $(call c_compile_test, Makefile.d/utsname_test.c) HAS_CLOCK_GETTIME := $(call c_compile_test, Makefile.d/clock_gettime_test.c) +HAS_EXTERN_LIBRT := $(call c_link_test, Makefile.d/clock_gettime_test.c, , -lrt) 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) @@ -901,8 +902,10 @@ endif ifeq ($(HAS_CLOCK_GETTIME), yes) FEATURE_FLAGS += -D'HAVE_CLOCK_GETTIME=1' +ifeq ($(HAS_EXTERN_LIBRT), yes) override LDFLAGS += -lrt endif +endif LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS) OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS) @@ -959,6 +962,7 @@ config: @echo "Checking for header \"linux/i2c.h\": $(HAS_LINUX_I2C)" @echo "Checking for header \"sys/utsname.h\": $(HAS_UTSNAME)" @echo "Checking for function \"clock_gettime\": $(HAS_CLOCK_GETTIME)" + @echo "Checking for external \"librt\": $(HAS_EXTERN_LIBRT)" @if ! [ "$(PROGRAMMER_OBJS)" ]; then \ echo "You have to enable at least one programmer driver!"; \ exit 1; \ |