aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJiao, Joey <jiangenj@qti.qualcomm.com>2025-05-08 09:00:40 +0800
committerDmitry Vyukov <dvyukov@google.com>2025-05-13 06:52:40 +0000
commit9497799b814907703e4a8bb6d32afe684570c848 (patch)
treeae40481652ce7199cf1bff5185295c986c8a4e25 /Makefile
parentf6671af7193a6d6860e38e17e108afb5934568dc (diff)
Makefile: add DEBUG=true env to enable debug symbols
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 92d649075..d61d27cb8 100644
--- a/Makefile
+++ b/Makefile
@@ -72,8 +72,15 @@ GITREVDATE=$(shell git log -n 1 --format="%cd" --date=format:%Y%m%d-%H%M%S)
# Don't generate symbol table and DWARF debug info.
# Reduces build time and binary sizes considerably.
# That's only needed if you use gdb or nm.
-# If you need that, build manually without these flags.
-GOFLAGS := "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X 'github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)'"
+# If you need that, build manually with DEBUG=true env.
+GLFLAGS :=
+GGFLAGS :=
+ifeq ("$(DEBUG)", "true")
+ GGFLAGS := -gcflags="all=-N -l"
+else
+ GLFLAGS := -s -w
+endif
+GOFLAGS := -ldflags="$(GLFLAGS) -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)" $(GGFLAGS)
ifneq ("$(GOTAGS)", "")
GOFLAGS += " -tags=$(GOTAGS)"
endif