[PATCH] DEBUG mode in Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Added DEBUG symbol for Makefile. If defined in the command line as DEBUG=1
it turns off the optimizations, makes the binary (thru the compilation flags)
to include line info and to be gdb-friendly.

Signed-off-by: Alexander Nezhinsky <alexandern@xxxxxxxxxxxx>
---
 usr/Makefile |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/usr/Makefile b/usr/Makefile
index 322ecfb..a138f98 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -50,7 +50,12 @@ INCLUDES += -I.
 
 CFLAGS += -D_GNU_SOURCE
 CFLAGS += $(INCLUDES)
-CFLAGS += -g -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -fPIC
+ifneq ($(DEBUG),)
+CFLAGS += -g -O0 -ggdb -rdynamic
+else
+CFLAGS += -g -O2 -fno-strict-aliasing
+endif
+CFLAGS += -Wall -Wstrict-prototypes -fPIC
 CFLAGS += -DTGT_VERSION=\"$(VERSION)$(EXTRAVERSION)\"
 
 LIBS += -lpthread
--
1.7.3
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux