Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve make debug #1156

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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)
Expand Down
Loading