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>
This commit is contained in:
Robin Jarry 2022-02-02 20:44:29 +01:00
parent e0b5f2e08c
commit 1f99581f67
2 changed files with 8 additions and 3 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
.go .go
/aerc2 /aerc2
/aerc /aerc
/aerc.debug
log log
raw.log raw.log
aerc.conf aerc.conf

View file

@ -50,9 +50,13 @@ checkfmt:
aerc.conf: config/aerc.conf.in aerc.conf: config/aerc.conf.in
sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in
debug: $(GOSRC) .PHONY: debug
dlv debug --build-flags="$(GOFLAGS)" --headless \ debug: aerc.debug
--listen localhost:4747 >/dev/null 2>&1 @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: .1.scd.1:
scdoc < $< > $@ scdoc < $< > $@