From 0433548ac8300100ac1f2aa69d90e1bb374d1a25 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Thu, 16 Jun 2016 13:40:31 -0700 Subject: usb_updater: allow to define target environment It is necessary to be able to build usb_updater for both host and board environments. When building for board environments the appropriate compiler and binutils are defined in the environment. Allow the environment definitions to take precedence over local definitions. BUG=none TEST=inside and outside chroot: . ran 'make clean; make; verified that command can be run on the host. inside chroot: . ran 'emerge-kevin ec-utils' and verified using the 'file' utility that the executable in /build/kevin/usr/sbin/usb_updater is built for arm Change-Id: If2ac4a4e7f7ece188eba5ff917a510363c6d1990 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/353165 Reviewed-by: Bill Richardson --- extra/usb_updater/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'extra') diff --git a/extra/usb_updater/Makefile b/extra/usb_updater/Makefile index b4c208f4af..2173e464d9 100644 --- a/extra/usb_updater/Makefile +++ b/extra/usb_updater/Makefile @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +CC ?= gcc +PKG_CONFIG ?= pkg-config PROGRAM := usb_updater SOURCE := $(PROGRAM).c LIBS := @@ -22,15 +24,15 @@ CFLAGS := -std=gnu99 \ # # Add libusb-1.0 required flags # -LIBS += $(shell pkg-config --libs libusb-1.0) -lcrypto -CFLAGS += $(shell pkg-config --cflags libusb-1.0) +LIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0 libcrypto) +CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0 libcrypto) # NOTE: This may be board-specific BOARD ?= cr50 CFLAGS += -I../../include -I../../board/$(BOARD) -I ../../chip/g -I../../util $(PROGRAM): $(SOURCE) Makefile - gcc $(CFLAGS) $(SOURCE) $(LFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) $(SOURCE) $(LFLAGS) $(LIBS) -o $@ .PHONY: clean -- cgit v1.2.1