2009/12/24 Carl-Daniel Hailfinger <span dir="ltr"><<a href="mailto:c-d.hailfinger.devel.2006@gmx.net">c-d.hailfinger.devel.2006@gmx.net</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Only check for requested features in the Makefile.<br>
libpci is no longer required to build flashrom and will not be checked<br>
for if no PCI code is needed for the selected programmers.<br>
libftdi is no longer checked for if FT2232 support is not selected.<br>
<br>
With this patch, it is possible to build on pretty much every OS out<br>
there (including Windows) without altering the Makefile.<br>
Some gcc versions may need a CFLAGS override for a warning in<br>
dummyflasher.c, though.<br>
<br>
Signed-off-by: Carl-Daniel Hailfinger <<a href="mailto:c-d.hailfinger.devel.2006@gmx.net">c-d.hailfinger.devel.2006@gmx.net</a>><br>
<br>
Index: flashrom-makefile_check_libpci_only_if_needed/Makefile<br>
===================================================================<br>
--- flashrom-makefile_check_libpci_only_if_needed/Makefile      (Revision 822)<br>
+++ flashrom-makefile_check_libpci_only_if_needed/Makefile      (Arbeitskopie)<br>
@@ -41,8 +41,6 @@<br>
 LDFLAGS += -L/usr/local/lib<br>
 endif<br>
<br>
-LIBS += -lpci<br>
-<br>
 OBJS = jedec.o stm50flw0x0x.o w39v080fa.o sharplhf00l04.o w29ee011.o \<br>
        sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o w39v040c.o \<br>
        w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o m29f002.o \<br>
@@ -167,6 +165,7 @@<br>
 endif<br>
<br>
 ifeq ($(NEED_PCI), yes)<br>
+LIBS += -lpci<br>
 FEATURE_CFLAGS += -D'NEED_PCI=1'<br>
 OBJS += pcidev.o physmap.o internal.o<br>
 endif<br>
@@ -211,6 +210,7 @@<br>
                rm -f .test.c .test; exit 1)<br>
        @rm -f .test.c .test<br>
<br>
+ifeq ($(NEED_PCI), yes)<br>
 pciutils: compiler<br>
        @printf "Checking for libpci headers... "<br>
        @$(shell ( echo "#include <pci/pci.h>";            \<br>
@@ -226,25 +226,30 @@<br>
        @$(shell ( echo "#include <pci/pci.h>";            \<br>
                   echo "int main(int argc, char **argv)"; \<br>
                   echo "{ return 0; }"; ) > .test1.c )<br>
-       @$(CC) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 $(LIBS) >/dev/null 2>&1 &&       \<br>
+       @$(CC) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 -lpci $(LIBS) >/dev/null 2>&1 && \<br>
                echo "found." || ( echo "not found."; echo;                             \<br>
                echo "Please install libpci (package pciutils).";                       \<br>
                echo "See README for more information."; echo;                          \<br>
                rm -f .test1.c .test1; exit 1)<br>
        @printf "Checking if libpci is sufficient... "<br>
        @printf "" > .libdeps<br>
-       @$(CC) $(LDFLAGS) .test.o -o .test $(LIBS) >/dev/null 2>&1 &&                           \<br>
+       @$(CC) $(LDFLAGS) .test.o -o .test -lpci $(LIBS) >/dev/null 2>&1 &&                             \<br>
                echo "yes." || ( echo "no.";                                                    \<br>
                printf "Checking if libz is present and supplies all needed symbols...";        \<br>
-               $(CC) $(LDFLAGS) .test.o -o .test $(LIBS) -lz >/dev/null 2>&1 &&                \<br>
+               $(CC) $(LDFLAGS) .test.o -o .test -lpci -lz $(LIBS) >/dev/null 2>&1 &&          \<br>
                ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo "no."; echo;       \<br>
                echo "Please install libz.";                    \<br>
                echo "See README for more information."; echo;                          \<br>
                rm -f .test.c .test.o .test; exit 1) )<br>
        @rm -f .test.c .test.o .test .test1.c .test1<br>
+else<br>
+pciutils: compiler<br>
+       @printf "" > .libdeps<br>
+endif<br>
<br>
 .features: features<br>
<br>
+ifeq ($(CONFIG_FT2232SPI), yes)<br>
 features: compiler<br>
        @echo "FEATURES := yes" > .features.tmp<br>
        @printf "Checking for FTDI support... "<br>
@@ -257,6 +262,10 @@<br>
                ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )<br>
        @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features<br>
        @rm -f .featuretest.c .featuretest<br>
+else<br>
+features: compiler<br>
+       @echo "FEATURES := yes" > .features<br>
+endif<br>
<br>
 install: $(PROGRAM)<br>
        mkdir -p $(DESTDIR)$(PREFIX)/sbin<br>
<br>
<br>
--<br>
Developer quote of the year:<br>
"We are juggling too many chainsaws and flaming arrows and tigers."<br>
<br>
<br>
_______________________________________________<br>
flashrom mailing list<br>
<a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a><br>
<a href="http://www.flashrom.org/mailman/listinfo/flashrom" target="_blank">http://www.flashrom.org/mailman/listinfo/flashrom</a><br>
</blockquote></div><br><span>Acked</span>-by: Idwer Vollering <vidwer<a href="mailto:audiohacked@gmail.com" target="_blank">@gmail.com</a>><br>