summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-06-19 14:20:34 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-06-19 14:20:34 +0000
commitb18ecbc93f1df32c78f173f0c704ba4d7b873d43 (patch)
tree579f05d4df99a05348755e31f5759d3bf065bec4 /Makefile
parent2eeff4ebb94058b8d20669f775b952d3c2522018 (diff)
downloadast2050-flashrom-b18ecbc93f1df32c78f173f0c704ba4d7b873d43.zip
ast2050-flashrom-b18ecbc93f1df32c78f173f0c704ba4d7b873d43.tar.gz
Prevent spurious runs of make features introduced by the FT2232 patch
The new makefile structure uses indirection (.features->features) to work around a gmake bug which resulted in immediate premature evaluation of variable definitions with deferred evaluation. Corresponding to flashrom svn r611. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 14 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index eba4d04..ae857a2 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \
ichspi.o w39v040c.o sb600spi.o wbsio_spi.o m29f002.o internal.o \
dummyflasher.o pcidev.o nic3com.o satasii.o ft2232_spi.o print.o
-all: pciutils .features dep $(PROGRAM)
+all: pciutils features dep $(PROGRAM)
# Set the flashrom version string from the highest revision number
# of the checked out flashrom files.
@@ -66,7 +66,11 @@ SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"'
$(PROGRAM): $(OBJS)
$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) $(FEATURE_LIBS)
-flashrom.o: flashrom.c
+FEATURE_CFLAGS = $(shell LANG=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'")
+
+FEATURE_LIBS = $(shell LANG=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-lftdi")
+
+flashrom.o: flashrom.c .features
$(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURE_CFLAGS) -c -o $@ $< $(SVNDEF)
%.o: %.c .features
@@ -93,9 +97,7 @@ compiler:
rm -f .test.c .test; exit 1)
@rm -f .test.c .test
-# We don't specify compiler as requirement because the compiler is already
-# checked during makefile remake through .features
-pciutils:
+pciutils: compiler
@printf "Checking for pciutils and zlib... "
@$(shell ( echo "#include <pci/pci.h>"; \
echo "struct pci_access *pacc;"; \
@@ -108,16 +110,18 @@ pciutils:
rm -f .test.c .test; exit 1)
@rm -f .test.c .test
-.features: compiler
+.features: features
+
+features: compiler
+ @echo "FEATURES := yes" > .features.tmp
@printf "Checking for FTDI support... "
@$(shell ( echo "#include <ftdi.h>"; \
echo "struct ftdi_context *ftdic = NULL;"; \
echo "int main(int argc, char **argv)"; \
echo "{ return ftdi_init(ftdic); }"; ) > .featuretest.c )
@$(CC) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(LIBS) -lftdi >/dev/null 2>&1 && \
- ( echo "found."; echo FEATURE_CFLAGS := -D'FT2232_SPI_SUPPORT=1' > .features.tmp; \
- echo FEATURE_LIBS := -lftdi >> .features.tmp) || \
- ( echo "not found."; echo "" > .features.tmp )
+ ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \
+ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )
@$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
@rm -f .featuretest.c .featuretest
@@ -138,7 +142,6 @@ tarball: export
@rm -rf $(EXPORTDIR)/flashrom-$(VERSION)
@echo Created $(EXPORTDIR)/flashrom-$(VERSION).tar.gz
-.PHONY: all clean distclean dep compiler pciutils export tarball
+.PHONY: all clean distclean dep compiler pciutils features export tarball
-include .dependencies
--include .features
OpenPOWER on IntegriCloud