From 00e14f044814ab2b4ea48b47d22a39a57bf5a057 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 27 Dec 2011 02:27:20 +0400 Subject: [PATCH] make: Add DEBUG=1 option This allows to use pr_debug and dprintk helpers. Signed-off-by: Cyrill Gorcunov --- Makefile | 4 ++++ include/util.h | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 43f136d63..85f910433 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,10 @@ ifneq ($(WERROR),0) WARNINGS += -Werror endif +ifeq ($(DEBUG),1) + DEFINES += -DCR_DEBUG +endif + WARNINGS += -Wall -Wno-unused CFLAGS += $(WARNINGS) $(DEFINES) diff --git a/include/util.h b/include/util.h index 56264ce08..5e2ec2316 100644 --- a/include/util.h +++ b/include/util.h @@ -60,15 +60,17 @@ extern void printk(const char *format, ...); pr_err_jmp(label); \ } while (0) -#if 0 +#ifdef CR_DEBUG #define pr_debug(fmt, ...) \ do { \ - printk("%s (%s:%d): " fmt, \ - __func__, __FILE__, __LINE__, \ + printk("%s:%d:%s: " fmt, \ + __FILE__, __LINE__,__func__, \ ##__VA_ARGS__); \ } while (0) +#define dprintk(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define pr_debug(fmt, ...) +#define dprintk(fmt, ...) #endif #define die(fmt, ...) \