mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
Let pkg-config work with cross-compilers
In cross-compiler setups pkg-config often needs some help to determine the correct libraries. This can be done for example by setting PKG_CONFIG_LIBDIR to point to the directory where the cross-compile .pc files are located. If PKG_CONFIG_LIBDIR was not set already outside of the Makefile we set it according to LIBS_BASE and add the respective path to the linker's rpath. This makes it possible to easily cross-compile by only setting CC and LIBS_BASE on the command line. This patch also removes the explicit default for LIBS_BASE again because it does not play well with this change and was a bad idea to begin with. Corresponding to flashrom svn r1876. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
5d1ad35275
commit
e37735a994
10
Makefile
10
Makefile
@ -37,7 +37,6 @@ MANDIR ?= $(PREFIX)/share/man
|
|||||||
CFLAGS ?= -Os -Wall -Wshadow
|
CFLAGS ?= -Os -Wall -Wshadow
|
||||||
EXPORTDIR ?= .
|
EXPORTDIR ?= .
|
||||||
RANLIB ?= ranlib
|
RANLIB ?= ranlib
|
||||||
LIBS_BASE ?= ..
|
|
||||||
|
|
||||||
# The following parameter changes the default programmer that will be used if there is no -p/--programmer
|
# The following parameter changes the default programmer that will be used if there is no -p/--programmer
|
||||||
# argument given when running flashrom. The predefined setting does not enable any default so that every
|
# argument given when running flashrom. The predefined setting does not enable any default so that every
|
||||||
@ -65,8 +64,11 @@ ifeq ($(WARNERROR), yes)
|
|||||||
CFLAGS += -Werror
|
CFLAGS += -Werror
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LIBS_BASE
|
||||||
CPPFLAGS += -I$(LIBS_BASE)/include
|
CPPFLAGS += -I$(LIBS_BASE)/include
|
||||||
LDFLAGS += -L$(LIBS_BASE)/lib
|
LDFLAGS += -L$(LIBS_BASE)/lib -Wl,-rpath -Wl,$(LIBS_BASE)/lib
|
||||||
|
PKG_CONFIG_LIBDIR ?= $(LIBS_BASE)/lib/pkgconfig
|
||||||
|
endif
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# General OS-specific settings.
|
# General OS-specific settings.
|
||||||
@ -613,7 +615,7 @@ PROGRAMMER_OBJS += usbblaster_spi.o
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(NEED_FTDI), yes)
|
ifeq ($(NEED_FTDI), yes)
|
||||||
FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb")
|
FTDILIBS := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --libs libftdi || printf "%s" "-lftdi -lusb")
|
||||||
FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'")
|
FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'")
|
||||||
FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)")
|
FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)")
|
||||||
# We can't set NEED_USB here because that would transform libftdi auto-enabling
|
# We can't set NEED_USB here because that would transform libftdi auto-enabling
|
||||||
@ -736,7 +738,7 @@ endif
|
|||||||
ifeq ($(NEED_USB), yes)
|
ifeq ($(NEED_USB), yes)
|
||||||
CHECK_LIBUSB0 = yes
|
CHECK_LIBUSB0 = yes
|
||||||
FEATURE_CFLAGS += -D'NEED_USB=1'
|
FEATURE_CFLAGS += -D'NEED_USB=1'
|
||||||
USBLIBS := $(shell pkg-config --libs libusb 2>/dev/null || printf "%s" "-lusb")
|
USBLIBS := $(shell ([ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ); pkg-config --libs libusb || printf "%s" "-lusb")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_PRINT_WIKI), yes)
|
ifeq ($(CONFIG_PRINT_WIKI), yes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user