changeset 1045:13e374b9c522

make: add DEBUG option
author David Demelier <markand@malikania.fr>
date Sun, 20 Jun 2021 09:13:37 +0200
parents a4afc89f6ea8
children 8fc354b3e198
files GNUmakefile INSTALL.md
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/GNUmakefile	Sun Jun 20 08:42:22 2021 +0200
+++ b/GNUmakefile	Sun Jun 20 09:13:37 2021 +0200
@@ -17,7 +17,7 @@
 #
 
 CC=             cc
-CFLAGS=         -O0 -DNDEBUG -Wall -Wextra -Wno-cpp -g -fPIC
+CFLAGS=         -Wall -Wextra -Wno-cpp
 
 PREFIX=         /usr/local
 BINDIR=         ${PREFIX}/bin
@@ -147,6 +147,12 @@
 # Compile flags.
 DEFS=           -D_BSD_SOURCE -DLIBBSD_OVERLAY -DTOP=\"`pwd`\"
 
+ifeq (${DEBUG},1)
+CFLAGS+=        -O0 -g
+else
+CFLAGS+=        -O0 -g
+endif
+
 # Include directories.
 INCS=           -I lib/
 INCS+=          -I ./
--- a/INSTALL.md	Sun Jun 20 08:42:22 2021 +0200
+++ b/INSTALL.md	Sun Jun 20 09:13:37 2021 +0200
@@ -60,6 +60,8 @@
 
 - `SSL`: set to 1 or 0 to enable/disable OpenSSL (default: 1).
 - `JS`: set to 1 or 0 to disable Javascript (default: 1).
+- `DEBUG`: set to 1 or 0 to build with debug symbols and optimizations disabled
+  (default: 0).
 
 You can tweak the installation directories by changing the following variables
 (note: all paths must be absolute):