Browse files

disable debug output for default compile

Writing debug output to the log file will now only be
enabled when you compile with the variable DEBUG defined.

e.g.:

  make DEBUG=1

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
  • Loading branch information...
1 parent 5fee73c commit 92b171e0fb28f392683f4af0b68b6fa7e31d8659 Heiko Voigt committed Mar 22, 2012
Showing with 28 additions and 8 deletions.
  1. +2 −2 common/debug.c
  2. +10 −2 common/debug.h
  3. +1 −1 common/exec.c
  4. +5 −1 explorer/Makefile
  5. +5 −1 finder/Makefile
  6. +5 −1 nautilus/Makefile
View
4 common/debug.c
@@ -17,7 +17,7 @@ static void reset_inherit_flag(FILE *file)
}
#endif
-void debug_git(char * format, ...)
+void _debug_git(char * format, ...)
{
if (!debug_git_fp) {
#ifdef _WIN32
@@ -47,7 +47,7 @@ void debug_git(char * format, ...)
}
}
-void debug_git_mbox(char *format, ...)
+void _debug_git_mbox(char *format, ...)
{
va_list params;
char buffer[1024];
View
12 common/debug.h
@@ -2,7 +2,15 @@
#define DEBUG_H
typedef void reporter(char *format, ...);
-void debug_git(char * format, ...);
-void debug_git_mbox(char *format, ...);
+void _debug_git(char * format, ...);
+void _debug_git_mbox(char *format, ...);
+
+#ifdef DEBUG
+# define debug_git _debug_git
+# define debug_git_mbox _debug_git_mbox
+#else
+# define debug_git
+# define debug_git_mbox
+#endif
#endif /* DEBUG_H */
View
2 common/exec.c
@@ -46,7 +46,7 @@ int exec_program_v(const char *working_directory,
int status = 0;
int ret;
- reporter *debug = QUIETMODE & flags ? debug_git : debug_git_mbox;
+ reporter *debug = QUIETMODE & flags ? _debug_git : _debug_git_mbox;
if (!git_path()) {
debug("[ERROR] Could not find git path");
View
6 explorer/Makefile
@@ -10,6 +10,10 @@ WIN32_IE=0x0500
TARGET=$(TARGET32)
endif
+ifdef DEBUG
+ DBG_CFLAGS=-DDEBUG
+endif
+
CC = $(cross)gcc.exe
DLLWRAP = $(cross)dllwrap.exe
WINDRES = $(cross)windres
@@ -33,7 +37,7 @@ else
endif
# define _WIN32_IE, so IColumnProvider's structures are available
-CFLAGS=-O -g -DNO_MMAP -DNO_PREAD -DNO_STRLCPY -D_WIN32_IE=$(WIN32_IE) $(OSCFLAGS)
+CFLAGS=-O -g -DNO_MMAP -DNO_PREAD -DNO_STRLCPY -D_WIN32_IE=$(WIN32_IE) $(OSCFLAGS) $(DBG_CFLAGS)
DLLWRAPFLAGS = -Wl,--enable-stdcall-fixup $(OSDLLWRAPFLAG)
MSYSGIT_PATH=$(shell cd /; pwd -W | sed -e 's|/|\\\\\\\\|g')
View
6 finder/Makefile
@@ -1,4 +1,8 @@
-CFLAGS = -g -pedantic -Wall -std=c99
+ifdef DEBUG
+ DBG_CFLAGS=-DDEBUG
+endif
+
+CFLAGS = -g -pedantic -Wall -std=c99 $(DBG_CFLAGS)
TARGET = git-cheetah
MODULES = menu.c util.c plugin.c ../compat/posix.c
View
6 nautilus/Makefile
@@ -6,11 +6,15 @@ LIBDIR = /usr/lib
LDFLAGS = -shared \
$(shell pkg-config --libs libnautilus-extension)
+ifdef DEBUG
+ DBG_CFLAGS=-DDEBUG
+endif
+
WFLAGS=-std=c99 -Wall -pedantic
# needed to get the proper declarations for glibc
COMPAT_CFLAGS = -D_POSIX_C_SOURCE=200112L -D_GNU_SOURCE
-CFLAGS = $(WFLAGS) -fPIC -g $(COMPAT_CFLAGS) \
+CFLAGS = $(WFLAGS) -fPIC -g $(COMPAT_CFLAGS) $(DBG_CFLAGS) \
$(shell pkg-config --cflags libnautilus-extension)
export CFLAGS

0 comments on commit 92b171e

Please sign in to comment.