Skip to content

Commit

Permalink
Make debug builds more usable by only applying -O2 to normal builds
Browse files Browse the repository at this point in the history
Removes some misleading cruft as well.

Closes #1108
  • Loading branch information
Jalle19 committed Jun 28, 2024
1 parent 2a5d49e commit e490f7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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
10 changes: 5 additions & 5 deletions src/Makefile.in
Original file line number Diff line number Diff line change
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

0 comments on commit e490f7a

Please sign in to comment.