diff options
author | Thomas Heijligen <thomas.heijligen@secunet.com> | 2021-10-26 12:44:36 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-11-07 16:59:32 +0000 |
commit | 2dae0b764f23fa3359f39b88d889205940d3c60f (patch) | |
tree | 2a0a0fa17ec76e26960853b63802f9467f5c244c /Makefile | |
parent | 47caa9ceb1437ccd4de4e0da6b2fb307bc68d6e3 (diff) | |
download | flashrom-2dae0b764f23fa3359f39b88d889205940d3c60f.tar.gz flashrom-2dae0b764f23fa3359f39b88d889205940d3c60f.tar.bz2 flashrom-2dae0b764f23fa3359f39b88d889205940d3c60f.zip |
Makefile: Revise utsname and clock_gettime test
Clean up the feature target by outsourcing the test to an own variable.
Change the print output and don't write to the build-details file.
HAS_CLOCK_GETTIME=no replaces DISABLE_CLOCK_GETTIME=yes
This is in preparation for further changes.
Change-Id: Ie1f43b3d5a8ad79bff3f9bbc21f359ec35abc42a
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58618
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 13 insertions, 22 deletions
@@ -168,6 +168,9 @@ override TARGET_OS := $(call c_macro_test, Makefile.d/os_test.h) override ARCH := $(call c_macro_test, Makefile.d/arch_test.h) override ENDIAN := $(call c_macro_test, Makefile.d/endian_test.h) +HAS_UTSNAME := $(call c_compile_test, Makefile.d/utsname_test.c) +HAS_CLOCK_GETTIME := $(call c_compile_test, Makefile.d/clock_gettime_test.c) + ifeq ($(TARGET_OS), $(filter $(TARGET_OS), FreeBSD OpenBSD DragonFlyBSD)) override CPPFLAGS += -I/usr/local/include override LDFLAGS += -L/usr/local/lib @@ -841,13 +844,17 @@ FEATURE_CFLAGS += -D'CONFIG_PRINT_WIKI=1' CLI_OBJS += print_wiki.o endif -FEATURE_CFLAGS += $(call debug_shell,grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'") - # We could use PULLED_IN_LIBS, but that would be ugly. FEATURE_LIBS += $(call debug_shell,grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz") -FEATURE_CFLAGS += $(call debug_shell,grep -q "CLOCK_GETTIME := yes" .features && printf "%s" "-D'HAVE_CLOCK_GETTIME=1'") -FEATURE_LIBS += $(call debug_shell,grep -q "CLOCK_GETTIME := yes" .features && printf "%s" "-lrt") +ifeq ($(HAS_UTSNAME), yes) +FEATURE_CFLAGS += -D'HAVE_UTSNAME=1' +endif + +ifeq ($(HAS_CLOCK_GETTIME), yes) +FEATURE_CFLAGS += -D'HAVE_CLOCK_GETTIME=1' +FEATURE_LIBS += -lrt +endif LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS) OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS) @@ -1059,24 +1066,8 @@ ifeq ($(CONFIG_NI845X_SPI), yes) exit 1; }; } \ 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1 endif - @printf "Checking for utsname support... " | tee -a $(BUILD_DETAILS_FILE) - @echo "$$UTSNAME_TEST" > .featuretest.c - @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE) - @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \ - ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ - ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) } 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) - @printf "Checking for clock_gettime support... " | tee -a $(BUILD_DETAILS_FILE) -ifeq ($(DISABLE_CLOCK_GETTIME), yes) - @ { ( echo "disabled."; echo "CLOCK_GETTIME := no" >>.features.tmp ) } \ - 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) -else - @echo "$$CLOCK_GETTIME_TEST" >.featuretest.c - @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -lrt .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE) - @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -lrt .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \ - ( echo "found."; echo "CLOCK_GETTIME := yes" >>.features.tmp ) || \ - ( echo "not found."; echo "CLOCK_GETTIME := no" >>.features.tmp ) } \ - 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE) -endif + @echo "Checking for header \"sys/utsname.h\": $(HAS_UTSNAME)" + @echo "Checking for function \"clock_gettime\": $(HAS_CLOCK_GETTIME)" @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX) |