From 77fff3b9d913b583344fcb4b10f7a45153baa6c8 Mon Sep 17 00:00:00 2001 From: Koston-0xDEADBEEF <117514537+Koston-0xDEADBEEF@users.noreply.github.com> Date: Fri, 31 Jan 2025 14:45:33 +0200 Subject: [PATCH] Add debug build (#958) (#959) Set DEBUG=1 for make to build with debug symbols and without optimizations. --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index affca69..9634284 100644 --- a/Makefile +++ b/Makefile @@ -50,11 +50,17 @@ OBJ = $(C_SRC:%.c=$(BUILDDIR)/%.c.o) $(CPP_SRC:%.cpp=$(BUILDDIR)/%.cpp.o) $(IMG: DEP = $(C_SRC:%.c=$(BUILDDIR)/%.c.d) $(CPP_SRC:%.cpp=$(BUILDDIR)/%.cpp.d) DFLAGS = $(INCLUDE) -D_7ZIP_ST -DPACKAGE_VERSION=\"1.3.3\" -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_STDLIB_H -DHAVE_SYS_PARAM_H -DENABLE_64_BIT_WORDS=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\" -CFLAGS = $(DFLAGS) -Wall -Wextra -Wno-strict-aliasing -Wno-stringop-overflow -Wno-stringop-truncation -Wno-format-truncation -Wno-psabi -Wno-restrict -c -O3 +CFLAGS = $(DFLAGS) -Wall -Wextra -Wno-strict-aliasing -Wno-stringop-overflow -Wno-stringop-truncation -Wno-format-truncation -Wno-psabi -Wno-restrict -c LFLAGS = -lc -lstdc++ -lm -lrt $(IMLIB2_LIB) -Llib/bluetooth -lbluetooth -lpthread OUTPUT_FILTER = sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):\([0-9]\+\):/\1(\2,\ \3):/g' +ifneq ($(DEBUG),1) + CFLAGS += -O3 +else + CFLAGS += -O0 -g -fomit-frame-pointer +endif + ifeq ($(PROFILING),1) DFLAGS += -DPROFILING endif @@ -63,7 +69,9 @@ $(BUILDDIR)/$(PRJ): $(OBJ) $(Q)$(info $@) $(Q)$(CC) -o $@ $+ $(LFLAGS) $(Q)cp $@ $@.elf +ifneq ($(DEBUG),1) $(Q)$(STRIP) $@ +endif .PHONY: clean clean: