From c7ffd36a97681790301eb8c0d9ba23377c4c9fd8 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Thu, 5 Apr 2012 12:08:29 +0000
Subject: [PATCH] - Added automatic debug flags to CFLAGS if DEBUG is set in
shell
---
library/Makefile | 6 +++++-
programs/Makefile | 4 ++++
tests/Makefile | 4 ++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/library/Makefile b/library/Makefile
index 0b8682884..2a860ce2f 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -4,6 +4,10 @@
CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement
OFLAGS = -O
+ifdef DEBUG
+CFLAGS += -g3
+endif
+
# MicroBlaze specific options:
# CFLAGS += -mno-xl-soft-mul -mxl-barrel-shift
@@ -65,7 +69,7 @@ libpolarssl.dll: libpolarssl.a
$(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS) -lws2_32 -lwinmm -lgdi32
.c.o:
- echo " CC $<"
+ echo " CC $< $(CFLAGS)"
$(CC) $(CFLAGS) $(OFLAGS) -c $<
clean:
diff --git a/programs/Makefile b/programs/Makefile
index 7027743db..e6771ceb1 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -7,6 +7,10 @@ CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-state
OFLAGS = -O
LDFLAGS += -L../library -lpolarssl $(SYS_LDFLAGS)
+ifdef DEBUG
+CFLAGS += -g3
+endif
+
APPS = aes/aescrypt2 aes/crypt_and_hash \
hash/hello hash/generic_sum \
hash/md5sum hash/sha1sum \
diff --git a/tests/Makefile b/tests/Makefile
index 3d2c1bfd7..a44d8dcad 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -9,6 +9,10 @@ CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-state
OFLAGS = -O
LDFLAGS += -L../library -lpolarssl $(SYS_LDFLAGS)
+ifdef DEBUG
+CFLAGS += -g3
+endif
+
APPS = test_suite_aes test_suite_arc4 \
test_suite_base64 test_suite_camellia \
test_suite_cipher.aes test_suite_cipher.camellia \