diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-03-13 00:18:19 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-03-13 00:18:19 +0000 |
commit | ca5d3c7a2c30879295c16ec200b270e94bab26b9 (patch) | |
tree | b10ec294018a6fd534f4676587332beb7b654f45 /Makefile | |
parent | 93a46475482b18c270b13283759085d2c68de384 (diff) | |
download | flashrom-ca5d3c7a2c30879295c16ec200b270e94bab26b9.zip flashrom-ca5d3c7a2c30879295c16ec200b270e94bab26b9.tar.gz |
Make the presence of Linux SPI headers mandatory for linux_spi
This solution is copied from ft2232_spi and is equally hacky.
Thanks to M.K. for investigating the history of <linux/spi/spidev.h>, which
led to a hopefully more robust check.
Corresponding to flashrom svn r1517.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -485,7 +485,8 @@ NEED_PCI := yes endif ifeq ($(CONFIG_LINUX_SPI), yes) -FEATURE_CFLAGS += -D'CONFIG_LINUX_SPI=1' +# This is a totally ugly hack. +FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_SPI_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_SPI=1'") PROGRAMMER_OBJS += linux_spi.o endif @@ -671,6 +672,19 @@ int main(int argc, char **argv) endef export UTSNAME_TEST +define LINUX_SPI_TEST +#include <linux/types.h> +#include <linux/spi/spidev.h> + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return 0; +} +endef +export LINUX_SPI_TEST + features: compiler @echo "FEATURES := yes" > .features.tmp ifeq ($(CONFIG_FT2232_SPI), yes) @@ -680,6 +694,13 @@ ifeq ($(CONFIG_FT2232_SPI), yes) ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) endif +ifeq ($(CONFIG_LINUX_SPI), yes) + @printf "Checking if Linux SPI headers are present... " + @echo "$$LINUX_SPI_TEST" > .featuretest.c + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ + ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \ + ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp ) +endif @printf "Checking for utsname support... " @echo "$$UTSNAME_TEST" > .featuretest.c @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ |