From dac696d74d69a162d59918011d2635fd1268a52f Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Wed, 3 Oct 2012 20:50:37 +0300 Subject: [PATCH 1/2] corerctly handle debug messages --- Makefile | 2 +- helpers.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d725696..2ffd2ac 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION = 0.1 CC = gcc LIBS = -lm -lxcb -lxcb-icccm -lxcb-ewmh -CFLAGS = -g -std=c99 -pedantic -Wall -Wextra +CFLAGS = -g -std=c99 -pedantic -Wall -Wextra -DDEBUG LDFLAGS = $(LIBS) PREFIX ?= /usr/local diff --git a/helpers.h b/helpers.h index e89fa09..97e667a 100644 --- a/helpers.h +++ b/helpers.h @@ -14,12 +14,12 @@ #define XCB_CONFIG_WINDOW_X_Y_WIDTH_HEIGHT XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT #define XCB_CONFIG_WINDOW_X_Y XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y -#if 1 -# define PUTS(x) puts(x); -# define PRINTF(x,...) printf(x, ##__VA_ARGS__); +#ifdef DEBUG +# define PUTS(x) puts(x) +# define PRINTF(x,...) printf(x, ##__VA_ARGS__) #else -# define PUTS(x) ; -# define PRINTF(x) ; +# define PUTS(x) ((void)0) +# define PRINTF(x,...) ((void)0) #endif void logmsg(FILE *, char *, va_list); From 3f914c72974a4fb42b13a4a300aef54dba1aeb30 Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Wed, 3 Oct 2012 20:53:16 +0300 Subject: [PATCH 2/2] separate rules for debug and stripped binaries --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2ffd2ac..fc508d9 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION = 0.1 CC = gcc LIBS = -lm -lxcb -lxcb-icccm -lxcb-ewmh -CFLAGS = -g -std=c99 -pedantic -Wall -Wextra -DDEBUG +CFLAGS = -std=c99 -pedantic -Wall -Wextra LDFLAGS = $(LIBS) PREFIX ?= /usr/local @@ -14,7 +14,12 @@ CL_SRC = bspc.c helpers.c WM_OBJ = $(WM_SRC:.c=.o) CL_OBJ = $(CL_SRC:.c=.o) -all: options clean bspwm bspc +debug: CFLAGS += -O0 -g -DDEBUG +debug: options bspwm bspc + +all: CFLAGS += -Os +all: LDFLAGS += -s +all: options bspwm bspc options: @echo "bspwm build options:" @@ -27,11 +32,11 @@ options: @echo "CC $<" @$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $< -bspwm: $(WM_OBJ) +bspwm: $(WM_OBJ) @echo CC -o $@ @$(CC) -o $@ $(WM_OBJ) $(LDFLAGS) -bspc: $(CL_OBJ) +bspc: $(CL_OBJ) @echo CC -o $@ @$(CC) -o $@ $(CL_OBJ) $(LDFLAGS)