diff options
author | Robin Krahl <me@robin-krahl.de> | 2018-03-27 17:46:49 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2018-03-27 17:46:49 +0200 |
commit | cecedeca90bf231c5cd10b618ee2a61feb25cf83 (patch) | |
tree | 807254f71a46d36172625193c3cffe262e1f899d | |
parent | 84d42361984b3ab087222893eef912baed283757 (diff) | |
download | midbro-cecedeca90bf231c5cd10b618ee2a61feb25cf83.tar.gz midbro-cecedeca90bf231c5cd10b618ee2a61feb25cf83.tar.bz2 |
Print verbose messages only for debug builds
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | src/midbro.c | 4 |
2 files changed, 13 insertions, 2 deletions
@@ -3,12 +3,19 @@ LIBCFLAGS =-c -fPIC -DBROCCOLI CFLAGS =-c -DBROCCOLI INC =-I/usr/local/include -I/usr/local/include -I./includes LDFLAGS = -L/usr/local/lib -lbroccoli -pthread -DEBUG = SRC = midbro.c broevent.c fifoqueue.c OBJ = $(patsubst %.c, build/%.o, $(SRC)) PREFIX = $(DESTDIR)/usr/local +ifneq ($(DEBUG), 1) + CFLAGS += -O2 + CPPFLAGS += -DNDEBUG +else + CFLAGS += -g + CPPFLAGS += -DDEBUG +endif + .PHONY: all dirs clean install uninstall lib/midbro bin/tests all: dirs lib/midbro @@ -23,7 +30,7 @@ midbro_test: $(CC) test/midbro_test.c -I./includes -o bin/midbro_test -L./lib -lmidbro build/%.o: src/%.c - $(CC) $(LIBCFLAGS) $(DEBUG) $(INC) $< -o $@ + $(CC) $(LIBCFLAGS) $(INC) $< -o $@ bin/tests: build/fifoqueue.o build/tests.o $(CC) $^ -o bin/tests $(LDFLAGS) diff --git a/src/midbro.c b/src/midbro.c index 60411d2..80433d6 100644 --- a/src/midbro.c +++ b/src/midbro.c @@ -61,7 +61,9 @@ request_n_values(int number, int arrayOfValues[]) arrayOfValues[i] = sensor->value; free(sensor); } +#ifdef DEBUG printf("Release %d sensor data values\n", number); +#endif } int request_value() @@ -71,7 +73,9 @@ request_value() sensor = pop_from_queue(queue); value = sensor->value; free(sensor); +#ifdef DEBUG printf("Release 1 sensor data value\n"); +#endif return value; } |