From 2d10951a2ed9d9c6dc312097aca5d4ae9a30f331 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Fri, 18 Mar 2016 12:10:49 +0100
Subject: [PATCH] introduce T_TRACER to globally enable/disable the T

---
 Makefile        | 2 +-
 T.h             | 9 +++++++++
 tracer/Makefile | 4 ++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c65ed27b8e..27e1c8a5c0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC=gcc
-CFLAGS=-Wall -g -pthread
+CFLAGS=-Wall -g -pthread -DT_TRACER
 
 #comment those two lines to NOT use shared memory
 CFLAGS += -DT_USE_SHARED_MEMORY
diff --git a/T.h b/T.h
index 46c5bdc180..d88f33a81c 100644
--- a/T.h
+++ b/T.h
@@ -1,6 +1,8 @@
 #ifndef _T_T_T_
 #define _T_T_T_
 
+#if T_TRACER
+
 #include <stdint.h>
 
 #include "T_defs.h"
@@ -517,4 +519,11 @@ extern int *T_active;
 
 void T_connect_to_tracer(char *addr, int port);
 
+#else /* T_TRACER */
+
+/* if T_TRACER is not defined or is 0, the T is deactivated */
+#define T(...) /**/
+
+#endif /* T_TRACER */
+
 #endif /* _T_T_T_ */
diff --git a/tracer/Makefile b/tracer/Makefile
index 23309eb85e..a38ba5c2c6 100644
--- a/tracer/Makefile
+++ b/tracer/Makefile
@@ -1,7 +1,7 @@
 CC=gcc
-CFLAGS=-Wall -g -pthread
+CFLAGS=-Wall -g -pthread -DT_TRACER
 
-CFLAGS += -O3 -ffast-math -fomit-frame-pointer
+#CFLAGS += -O3 -ffast-math -fomit-frame-pointer
 
 LIBS=-lX11 -lm
 
-- 
GitLab