summaryrefslogtreecommitdiff
path: root/Makefile.toolchain
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2013-04-11 10:39:24 -0700
committerChromeBot <chrome-bot@google.com>2013-04-16 09:43:45 -0700
commit357e508392ca37b60ea17a9ac5725f84586aac9e (patch)
tree20a2800b1fee7e81f8c172dab0df03abdd8c0147 /Makefile.toolchain
parent0498d687326aca32e074e74e970a6e32fc839d93 (diff)
downloadchrome-ec-357e508392ca37b60ea17a9ac5725f84586aac9e.tar.gz
Allow either libftdi or libftdi1 at compile time.
Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=chromium:222299 TEST=manual, from chroot: 1. Install libftdi1 (https://gerrit.chromium.org/gerrit/#/c/44731/) 2. cd <path>/ec && make -B - compiles successfully 3. Install libftdi 4. cd <path>/ec && make -B - still compiles successfully Change-Id: I6818d53faa1389937872b0a9826534db4760e448 Reviewed-on: https://gerrit.chromium.org/gerrit/47875 Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r--Makefile.toolchain16
1 files changed, 14 insertions, 2 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain
index fd64ff5c26..8b2de15a85 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -15,6 +15,7 @@ CPP=$(CROSS_COMPILE)cpp
LD=$(CROSS_COMPILE)ld
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
+PKG_CONFIG?=pkg-config
BUILDCC?=gcc
HOSTCC?=$(HOST_CROSS_COMPILE)gcc
@@ -33,7 +34,18 @@ CFLAGS_DEFINE=-DOUTDIR=$(out) -DCHIP=$(CHIP) -DBOARD_TASKFILE=ec.tasklist \
-DCHIP_VARIANT_$(CHIP_VARIANT) -DPROJECT=$(PROJECT)
CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(CFLAGS_TEST) $(EXTRA_CFLAGS)
CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(CFLAGS_WARN) $(CFLAGS_y)
-BUILD_CFLAGS=$(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
+
+FTDIVERSION=$(shell $(PKG_CONFIG) --modversion libftdi1 2>/dev/null)
+ifneq ($(FTDIVERSION),)
+ LIBFTDI_NAME=ftdi1
+else
+ LIBFTDI_NAME=ftdi
+endif
+
+LIBFTDI_CFLAGS=$(shell $(PKG_CONFIG) --cflags lib${LIBFTDI_NAME})
+LIBFTDI_LDLIBS=$(shell $(PKG_CONFIG) --libs lib${LIBFTDI_NAME})
+
+BUILD_CFLAGS= $(LIBFTDI_CFLAGS) $(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
HOST_CFLAGS=$(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
LDFLAGS=-nostdlib -X
-BUILD_LDFLAGS=-lftdi
+BUILD_LDFLAGS=$(LIBFTDI_LDLIBS)