aboutsummaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2024-03-06 15:22:56 -0800
committerMartin L Roth <gaumless@gmail.com>2024-03-09 23:35:36 +0000
commitf02e00a97a02c009e75cd93e6ded53ef690bd3db (patch)
tree0adf42b99632e4af7b1a8cb45ecd06373e3db19a /payloads
parent52b81845de44dfa1af50e203c2cab9a953a628f1 (diff)
tests: Add `DEBUG` make commandline option to generate debug symbols
Sometimes when a test doesn't work it's convenient to run it through GDB. This patch adds a variable you can set on the make commandline to conveniently enable all the compiler flags needed to make that work. Change-Id: I3ac80ad095e0b72cc3176cbf915d1f390cd01558 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81112 Reviewed-by: Jakub Czapiga <czapiga@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'payloads')
-rw-r--r--payloads/libpayload/tests/Makefile.mk8
1 files changed, 7 insertions, 1 deletions
diff --git a/payloads/libpayload/tests/Makefile.mk b/payloads/libpayload/tests/Makefile.mk
index e271a7cea8..9bac9e6505 100644
--- a/payloads/libpayload/tests/Makefile.mk
+++ b/payloads/libpayload/tests/Makefile.mk
@@ -47,7 +47,13 @@ TEST_CFLAGS += -Wwrite-strings -Wno-trigraphs -Wimplicit-fallthrough
TEST_CFLAGS += -Wstrict-aliasing -Wshadow -Werror
TEST_CFLAGS += -Wno-unknown-warning-option -Wno-source-mgr -Wno-main-return-type
-TEST_CFLAGS += -std=gnu11 -Os -ffunction-sections -fdata-sections -fno-builtin
+TEST_CFLAGS += -std=gnu11 -ffunction-sections -fdata-sections -fno-builtin
+
+ifneq ($(filter-out 0,$(DEBUG)),)
+TEST_CFLAGS += -Og -ggdb3
+else
+TEST_CFLAGS += -Os
+endif
# Make unit-tests detectable by the code
TEST_CFLAGS += -D__TEST__