1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-29 07:53:44 +02:00

Only check for requested features in the Makefile

Libpci is no longer required to build flashrom and will not be checked
for if no PCI code is needed for the selected programmers.
libftdi is no longer checked for if FT2232 support is not selected.

With this patch, it is possible to build on pretty much every OS out
there (including Windows) without altering the Makefile.
Some gcc versions may need a CFLAGS override for a warning in
dummyflasher.c, though.

Corresponding to flashrom svn r823.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer@gmail.com>
This commit is contained in:
Carl-Daniel Hailfinger 2009-12-24 03:33:11 +00:00
parent 36cc1c8144
commit 8a59ff0486

View File

@ -41,8 +41,6 @@ CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib LDFLAGS += -L/usr/local/lib
endif endif
LIBS += -lpci
OBJS = jedec.o stm50flw0x0x.o w39v080fa.o sharplhf00l04.o w29ee011.o \ OBJS = jedec.o stm50flw0x0x.o w39v080fa.o sharplhf00l04.o w29ee011.o \
sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o w39v040c.o \ sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o w39v040c.o \
w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o m29f002.o \ w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o m29f002.o \
@ -167,6 +165,7 @@ endif
endif endif
ifeq ($(NEED_PCI), yes) ifeq ($(NEED_PCI), yes)
LIBS += -lpci
FEATURE_CFLAGS += -D'NEED_PCI=1' FEATURE_CFLAGS += -D'NEED_PCI=1'
OBJS += pcidev.o physmap.o internal.o OBJS += pcidev.o physmap.o internal.o
endif endif
@ -211,6 +210,7 @@ compiler:
rm -f .test.c .test; exit 1) rm -f .test.c .test; exit 1)
@rm -f .test.c .test @rm -f .test.c .test
ifeq ($(NEED_PCI), yes)
pciutils: compiler pciutils: compiler
@printf "Checking for libpci headers... " @printf "Checking for libpci headers... "
@$(shell ( echo "#include <pci/pci.h>"; \ @$(shell ( echo "#include <pci/pci.h>"; \
@ -226,25 +226,30 @@ pciutils: compiler
@$(shell ( echo "#include <pci/pci.h>"; \ @$(shell ( echo "#include <pci/pci.h>"; \
echo "int main(int argc, char **argv)"; \ echo "int main(int argc, char **argv)"; \
echo "{ return 0; }"; ) > .test1.c ) echo "{ return 0; }"; ) > .test1.c )
@$(CC) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 $(LIBS) >/dev/null 2>&1 && \ @$(CC) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 -lpci $(LIBS) >/dev/null 2>&1 && \
echo "found." || ( echo "not found."; echo; \ echo "found." || ( echo "not found."; echo; \
echo "Please install libpci (package pciutils)."; \ echo "Please install libpci (package pciutils)."; \
echo "See README for more information."; echo; \ echo "See README for more information."; echo; \
rm -f .test1.c .test1; exit 1) rm -f .test1.c .test1; exit 1)
@printf "Checking if libpci is sufficient... " @printf "Checking if libpci is sufficient... "
@printf "" > .libdeps @printf "" > .libdeps
@$(CC) $(LDFLAGS) .test.o -o .test $(LIBS) >/dev/null 2>&1 && \ @$(CC) $(LDFLAGS) .test.o -o .test -lpci $(LIBS) >/dev/null 2>&1 && \
echo "yes." || ( echo "no."; \ echo "yes." || ( echo "no."; \
printf "Checking if libz is present and supplies all needed symbols..."; \ printf "Checking if libz is present and supplies all needed symbols..."; \
$(CC) $(LDFLAGS) .test.o -o .test $(LIBS) -lz >/dev/null 2>&1 && \ $(CC) $(LDFLAGS) .test.o -o .test -lpci -lz $(LIBS) >/dev/null 2>&1 && \
( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo "no."; echo; \ ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo "no."; echo; \
echo "Please install libz."; \ echo "Please install libz."; \
echo "See README for more information."; echo; \ echo "See README for more information."; echo; \
rm -f .test.c .test.o .test; exit 1) ) rm -f .test.c .test.o .test; exit 1) )
@rm -f .test.c .test.o .test .test1.c .test1 @rm -f .test.c .test.o .test .test1.c .test1
else
pciutils: compiler
@printf "" > .libdeps
endif
.features: features .features: features
ifeq ($(CONFIG_FT2232SPI), yes)
features: compiler features: compiler
@echo "FEATURES := yes" > .features.tmp @echo "FEATURES := yes" > .features.tmp
@printf "Checking for FTDI support... " @printf "Checking for FTDI support... "
@ -257,6 +262,10 @@ features: compiler
( echo "not found."; echo "FTDISUPPORT := no" >> .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 @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
@rm -f .featuretest.c .featuretest @rm -f .featuretest.c .featuretest
else
features: compiler
@echo "FEATURES := yes" > .features
endif
install: $(PROGRAM) install: $(PROGRAM)
mkdir -p $(DESTDIR)$(PREFIX)/sbin mkdir -p $(DESTDIR)$(PREFIX)/sbin