From: Peter Zotov Date: Tue, 15 Feb 2011 16:48:36 +0000 (+0300) Subject: Add optional -DDEBUG to Makefile. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=fc7b68944dab0d3cd695722eb430260935e51716;p=fw%2Fstlink Add optional -DDEBUG to Makefile. --- diff --git a/build/Makefile b/build/Makefile index 076f974..c50747f 100644 --- a/build/Makefile +++ b/build/Makefile @@ -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 "$@" "$<" diff --git a/src/gdb-server.c b/src/gdb-server.c index ad38c64..ef30a02 100644 --- a/src/gdb-server.c +++ b/src/gdb-server.c @@ -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) {