aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-02-02 20:44:29 +0100
committerRobin Jarry <robin@jarry.cc>2022-02-02 22:12:08 +0100
commit1f99581f67ddfb4fdd83d2c570458392f5941501 (patch)
treea5b029b7f7738e892e41967373bafe9df11a4d20
parente0b5f2e08cd766258bdfd5eb392690768d2f5964 (diff)
downloadaerc-1f99581f67ddfb4fdd83d2c570458392f5941501.tar.gz
mk: use debug to generate a non-optimized binary
Do not use this to run the debugger. Instead, build a non-optimized binary and display what command should be executed to attach to a running program. Signed-off-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--.gitignore1
-rw-r--r--Makefile10
2 files changed, 8 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 5ea4190f..5d04c977 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
.go
/aerc2
/aerc
+/aerc.debug
log
raw.log
aerc.conf
diff --git a/Makefile b/Makefile
index e0946214..a1973d26 100644
--- a/Makefile
+++ b/Makefile
@@ -50,9 +50,13 @@ checkfmt:
aerc.conf: config/aerc.conf.in
sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in
-debug: $(GOSRC)
- dlv debug --build-flags="$(GOFLAGS)" --headless \
- --listen localhost:4747 >/dev/null 2>&1
+.PHONY: debug
+debug: aerc.debug
+ @echo 'Run `./aerc.debug` and use this command in another terminal to attach a debugger:'
+ @echo ' dlv attach $$(pidof aerc.debug)'
+
+aerc.debug: $(GOSRC)
+ $(GO) build $(GOFLAGS) -gcflags=*=-N -gcflags=*=-l -ldflags="$(LDFLAGS)" -o aerc.debug
.1.scd.1:
scdoc < $< > $@