diff --git a/README.md b/README.md index a7a3e0a3f1..8f19c3ebc0 100644 --- a/README.md +++ b/README.md @@ -301,6 +301,12 @@ make EXTRA_CFLAGS="-DNEEDS_SENDMMSG_SHIM" The above command is useful if you're getting errors like `sendmmsg(): errno 38: Function not implemented` (usually only concerns really old systems). +To make a debug build (useful if minisatip crashes and you want to diagnose the issue): + +```bash +make debug +``` + ## Building a Debian package: ```bash diff --git a/src/Makefile.in b/src/Makefile.in index 6548d1d4b7..d0ec12253d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -16,7 +16,7 @@ AXE=@AXE@ DDCI=0 T2MI=0 -CFLAGS?=-Wall -Wno-switch -ggdb -fPIC -fno-common -Warray-bounds -O2 +CFLAGS?=-Wall -Wno-switch -ggdb -fPIC -fno-common -Warray-bounds CFLAGS += -I../src CFLAGS += $(EXTRA_CFLAGS) @CFLAGS@ LDFLAGS += @LDFLAGS@ -lpthread @@ -134,8 +134,12 @@ SOURCES-$(AXE) += axe.c CFLAGS-$(AXE) += -DAXE CFLAGS-$(EMBEDDED) += -DNO_BACKTRACE -CFLAGS-$(DEBUG) += -fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -fsanitize=undefined -static-libasan -static-libubsan -static-liblsan -fstack-protector-all +ifeq ($(DEBUG),1) +CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -fsanitize=undefined -static-libasan -static-libubsan -static-liblsan -fstack-protector-all +else +CFLAGS += -O2 +endif ifeq ($(STATIC),1) LDFLAGS+=$(addsuffix .a,$(addprefix -l:lib,$(LIBS))) @@ -166,10 +170,6 @@ all: $(TARGET) clean: rm -rf $(BUILDDIR) $(TARGET) >> /dev/null -debug: - CFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -fsanitize=null - @(MAKE) all - # pull in dependency info for *existing* .o files ifneq "$(MAKECMDGOALS)" "clean" -include $(DEPS)