From d311c0726e5864bd01f30f3cbefc9a2bb3ad2159 Mon Sep 17 00:00:00 2001 From: Cori Barker Date: Sun, 19 Apr 2026 20:43:24 +0100 Subject: Changed build options for debug and release --- configure.ac | 9 +++++++++ src/Makefile.am | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1297f0d..1772671 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,6 @@ AC_INIT([blc], [0.1.0]) AM_INIT_AUTOMAKE([foreign subdir-objects -Wall]) + AC_PROG_CXX AC_PROG_INSTALL @@ -10,4 +11,12 @@ AC_CONFIG_FILES([ src/Makefile ]) +# Debug flag +AC_ARG_ENABLE([debug], + AS_HELP_STRING([--enable-debug], [Build with debug flags]), + [debug=$enableval], + [debug=no]) + +AM_CONDITIONAL([DEBUG], [test "$debug" = "yes"]) + AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index b78467c..38951f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,4 +7,13 @@ blc_SOURCES = \ AM_CXXFLAGS = \ -std=c++17 \ - -I$(top_srcdir)/include + -I$(top_srcdir)/include \ + -Wall \ + -Wextra \ + -Wpedantic + +if DEBUG +AM_CXXFLAGS += -O0 -g3 -fsanitize=address,undefined -fno-omit-frame-pointer +else +AM_CXXFLAGS += -O2 -DNDEBUG +endif -- cgit v1.2.3