From 9497799b814907703e4a8bb6d32afe684570c848 Mon Sep 17 00:00:00 2001 From: "Jiao, Joey" Date: Thu, 8 May 2025 09:00:40 +0800 Subject: Makefile: add DEBUG=true env to enable debug symbols --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Makefile') 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 -- cgit mrf-deployment