summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-08-23 16:56:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-24 17:40:51 -0700
commitb7025581e79be5da9a3dd620cc0add7427bd5817 (patch)
tree9f11098911e6a83a50d9ddd210cf08e4b5b68429 /extra
parentdbd62c36da1fa1960a050cf569b93deaa194cea7 (diff)
downloadchrome-ec-b7025581e79be5da9a3dd620cc0add7427bd5817.tar.gz
usb_updater: allow to build for gdb debugging
The code should be compiled with -O0 for gdb use, otherwise various optimizations make it very difficult to follow the execution flow. With this patch adding DEBUG=1 to the environment or make command line causes the usb_updater utility built with -O0 instead of -O3. The debug flag is being changed to -g from -g3 as this code is not going to be able to benefit from the g3 features, especially when built inside chroot. BRANCH=none BUG=none TEST=verified that gdb can properly control execution when make is invoked with DEBUG=1 Change-Id: I50d8df46a7dd04d4d253b34146dde95f5388287d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374758 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r--extra/usb_updater/Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/extra/usb_updater/Makefile b/extra/usb_updater/Makefile
index 2173e464d9..9120b7d4dc 100644
--- a/extra/usb_updater/Makefile
+++ b/extra/usb_updater/Makefile
@@ -9,8 +9,7 @@ SOURCE := $(PROGRAM).c
LIBS :=
LFLAGS :=
CFLAGS := -std=gnu99 \
- -g3 \
- -O3 \
+ -g \
-Wall \
-Werror \
-Wpointer-arith \
@@ -21,6 +20,12 @@ CFLAGS := -std=gnu99 \
-Wredundant-decls \
-Wmissing-declarations
+ifeq (DEBUG,)
+CFLAGS += -O3
+else
+CFLAGS += -O0
+endif
+
#
# Add libusb-1.0 required flags
#