commit 589c5ffb82bca3d678abf5a6fee746db063b3411
parent 4e9e824d3a7339dd5e973f844417867a09d7224e
Author: Ed van Bruggen <edvb@uw.edu>
Date: Thu, 20 Jun 2019 21:06:21 -0700
Enable debug mode through make
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -3,6 +3,11 @@
include config.mk
+ifeq ($(DEBUG), 1)
+CFLAGS += -g -DDEBUG
+LDFLAGS += -g
+endif
+
EXE = tisp
SRC = tisp.c main.c
TIB = tibs/math.c tibs/io.c
diff --git a/config.mk b/config.mk
@@ -11,8 +11,11 @@ LIBS = -lm -ldl
# flags
CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=600
-CFLAGS = -g -std=c99 -pedantic -Wall -fPIC $(INCS) $(CPPFLAGS)
-LDFLAGS = -g -Wl,-rpath=$(DESTDIR)$(PREFIX)/lib/tisp $(LIBS)
+CFLAGS = -std=c99 -pedantic -Wall -fPIC $(INCS) $(CPPFLAGS)
+LDFLAGS = -Wl,-rpath=$(DESTDIR)$(PREFIX)/lib/tisp $(LIBS)
+
+# turn off debug mode by default
+DEBUG ?= 0
# compiler and linker
CC = cc