Add optional -DDEBUG to Makefile.
authorPeter Zotov <whitequark@whitequark.org>
Tue, 15 Feb 2011 16:48:36 +0000 (19:48 +0300)
committerPeter Zotov <whitequark@whitequark.org>
Tue, 15 Feb 2011 16:48:36 +0000 (19:48 +0300)
build/Makefile
src/gdb-server.c

index 076f974abb284d6842f469d4cd1a4900af487968..c50747fa87fbe79b59db7cbe3f9bca50d6eadb0a 100644 (file)
@@ -1,4 +1,5 @@
 PRG := st-util
+DEBUG := #-DDEBUG
 
 all: $(PRG)
 
@@ -13,7 +14,7 @@ $(PRG): $(OBJS)
 
 %.o: ../src/%.c
        gcc -O3 -g3 -Wall -Werror -c -std=gnu99 -MMD -MP \
-               -fno-strict-aliasing -Wno-unused \
+               -fno-strict-aliasing -Wno-unused $(DEBUG) \
                -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"\
                -o "$@" "$<"
 
index ad38c64c03eee063f37ec0c5a7d9ddd5efb9b985..ef30a029cc11b34dd0a4d756510f78a6c0ef5969 100644 (file)
@@ -95,7 +95,9 @@ int serve(struct stlink* sl, int port) {
                        return 1;
                }
 
-               //printf("recv: %s\n", packet);
+               #ifdef DEBUG
+               printf("recv: %s\n", packet);
+               #endif
 
                char* reply = NULL;
 
@@ -246,7 +248,9 @@ int serve(struct stlink* sl, int port) {
                }
 
                if(reply) {
-                       //printf("send: %s\n", reply);
+                       #ifdef DEBUG
+                       printf("send: %s\n", reply);
+                       #endif
 
                        int result = gdb_send_packet(client, reply);
                        if(result != 0) {