mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-28 23:43:42 +02:00
Retrieve linker flags for libftdi with pkg-config
Retrieve the proper linker flags for libftdi via pkg-config and fall back if pkg-config isn't available or if it doesn't know libftdi. Fix $LIBS and $FEATURE_LIBS to honor dependency order. The original patch is from Jörg, it has been updated by Carl-Daniel to work on the current tree and to have a fallback in case pkg-config is not available or not working. Corresponding to flashrom svn r762. Signed-off-by: Jörg Mayer <jmayer@loplof.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Jörg Mayer <jmayer@loplof.de>
This commit is contained in:
parent
754580e4eb
commit
8776db2372
7
Makefile
7
Makefile
@ -120,10 +120,11 @@ FEATURE_CFLAGS += -D'SATASII_SUPPORT=1'
|
|||||||
OBJS += satasii.o
|
OBJS += satasii.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb")
|
||||||
ifeq ($(CONFIG_FT2232SPI), yes)
|
ifeq ($(CONFIG_FT2232SPI), yes)
|
||||||
# This is a totally ugly hack.
|
# 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_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" "-lftdi")
|
FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)")
|
||||||
OBJS += ft2232_spi.o
|
OBJS += ft2232_spi.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -146,7 +147,7 @@ endif
|
|||||||
FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
|
FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
|
||||||
|
|
||||||
$(PROGRAM): $(OBJS)
|
$(PROGRAM): $(OBJS)
|
||||||
$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) $(FEATURE_LIBS)
|
$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(FEATURE_LIBS) $(LIBS)
|
||||||
|
|
||||||
# TAROPTIONS reduces information leakage from the packager's system.
|
# TAROPTIONS reduces information leakage from the packager's system.
|
||||||
# If other tar programs support command line arguments for setting uid/gid of
|
# If other tar programs support command line arguments for setting uid/gid of
|
||||||
@ -218,7 +219,7 @@ features: compiler
|
|||||||
echo "struct ftdi_context *ftdic = NULL;"; \
|
echo "struct ftdi_context *ftdic = NULL;"; \
|
||||||
echo "int main(int argc, char **argv)"; \
|
echo "int main(int argc, char **argv)"; \
|
||||||
echo "{ return ftdi_init(ftdic); }"; ) > .featuretest.c )
|
echo "{ return ftdi_init(ftdic); }"; ) > .featuretest.c )
|
||||||
@$(CC) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(LIBS) -lftdi >/dev/null 2>&1 && \
|
@$(CC) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \
|
||||||
( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \
|
( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \
|
||||||
( 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user