Patchwork Fix Makefile dependencies if FT2232SPI is not selected

login
register
about
Submitter Carl-Daniel Hailfinger
Date 2010-01-09 04:41:07
Message ID <4B4808E3.6000805@gmx.net>
Download mbox | patch
Permalink /patch/760/
State Accepted
Commit r844
Headers show

Comments

Carl-Daniel Hailfinger - 2010-01-09 04:41:07
Fix Makefile dependencies if FT2232SPI is not selected.
.features was always regenerated in that case, triggering whole-project
recompiles even if nothing changed.

If you want to test, run
make distclean
make CONFIG_INTERNAL=no CONFIG_SERPROG=no CONFIG_SATASII=no
CONFIG_DRKAISER=no CONFIG_NIC3COM=no CONFIG_BUSPIRATESPI=no
CONFIG_FT2232SPI=no CONFIG_DUMMY=yes
make CONFIG_INTERNAL=no CONFIG_SERPROG=no CONFIG_SATASII=no
CONFIG_DRKAISER=no CONFIG_NIC3COM=no CONFIG_BUSPIRATESPI=no
CONFIG_FT2232SPI=no CONFIG_DUMMY=yes

Without the patch, you get a full recompile on the second make call.
With the patch, make notices that nothing changed and thus does nothing.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Sean Nelson - 2010-01-09 05:33:32
Acked-by: Sean Nelson <audiohacked@gmail.com>
Carl-Daniel Hailfinger - 2010-01-09 14:18:31
On 09.01.2010 06:33, Sean Nelson wrote:
> Acked-by: Sean Nelson <audiohacked@gmail.com>

Thanks, r844.

Regards,
Carl-Daniel

Patch

Index: flashrom-ft2232_makefile_no_recompile/Makefile
===================================================================
--- flashrom-ft2232_makefile_no_recompile/Makefile	(Revision 841)
+++ flashrom-ft2232_makefile_no_recompile/Makefile	(Arbeitskopie)
@@ -136,8 +136,8 @@ 
 NEED_PCI := yes
 endif
 
+ifeq ($(CONFIG_FT2232SPI), yes)
 FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb")
-ifeq ($(CONFIG_FT2232SPI), yes)
 # This is a totally ugly hack.
 FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'")
 FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)")
@@ -280,7 +280,8 @@ 
 	@rm -f .featuretest.c .featuretest
 else
 features: compiler
-	@echo "FEATURES := yes" > .features
+	@echo "FEATURES := yes" > .features.tmp
+	@$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
 endif
 
 install: $(PROGRAM)