diff --git a/Makefile b/Makefile index 85cc3a795b08ae3e8edbd8e19debc3a04b11389d..350b2293203e034934c65b86b58e582df846c398 100644 --- a/Makefile +++ b/Makefile @@ -49,39 +49,40 @@ rpm deb: | build-all # install -d -m 755 build/bin/* $(PREFIX)/bin/lumberjack # install -d build/lib/* $(PREFIX)/lib -backoff.c: backoff.h -harvester.c: harvester.h proto.h str.h -emitter.c: emitter.h ring.h -lumberjack.c: backoff.h harvester.h emitter.h -str.c: str.h -proto.c: proto.h str.h -ring.c: ring.h -harvester.c: build/include/insist.h -lumberjack.c: build/include/insist.h +backoff.o: backoff.c backoff.h +harvester.o: harvester.c harvester.h proto.h str.h sleepdefs.h +emitter.o: emitter.c emitter.h ring.h sleepdefs.h +lumberjack.o: lumberjack.c backoff.h harvester.h emitter.h +str.o: str.c str.h +proto.o: proto.c proto.h str.h sleepdefs.h +ring.o: ring.c ring.h + +harvester.o: build/include/insist.h +lumberjack.o: build/include/insist.h # Vendor'd dependencies # If VENDOR contains 'zeromq' download and build it. ifeq ($(filter zeromq,$(VENDOR)),zeromq) -emitter.c: build/include/zmq.h -harvester.c: build/include/zmq.h -lumberjack.c: build/include/zmq.h +emitter.o: build/include/zmq.h +harvester.o: build/include/zmq.h +lumberjack.o: build/include/zmq.h build/bin/lumberjack: | build/bin build/lib/libzmq.$(LIBEXT) endif # zeromq ifeq ($(filter jemalloc,$(VENDOR)),jemalloc) -harvester.c lumberjack.c ring.c str.c: build/include/jemalloc/jemalloc.h +harvester.o lumberjack.o ring.o str.o: build/include/jemalloc/jemalloc.h build/bin/lumberjack: | build/lib/libjemalloc.$(LIBEXT) endif # jemalloc ifeq ($(filter openssl,$(VENDOR)),openssl) -proto.c: build/include/openssl/ssl.h -lumberjack.c: build/include/openssl/ssl.h +proto.o: build/include/openssl/ssl.h +lumberjack.o: build/include/openssl/ssl.h build/bin/lumberjack: | build/lib/libssl.$(LIBEXT) build/bin/lumberjack: | build/lib/libcrypto.$(LIBEXT) endif # openssl ifeq ($(filter zlib,$(VENDOR)),zlib) -proto.c: build/include/zlib.h +proto.o: build/include/zlib.h build/bin/lumberjack: | build/lib/libz.$(LIBEXT) endif # zlib @@ -90,13 +91,10 @@ test: | build/test/test_ring build/test/test_ring # Tests -test_ring.c: ring.h build/include/jemalloc/jemalloc.h build/include/insist.h +test_ring.o: ring.h build/include/jemalloc/jemalloc.h build/include/insist.h build/test/test_ring: test_ring.o ring.o | build/test $(CC) $(LDFLAGS) -o $@ $^ -ljemalloc -proto.o: proto.c - $(CC) $(CFLAGS) -c -o $@ $^ - build/bin/lumberjack.sh: lumberjack.sh | build/bin install -m 755 $^ $@ diff --git a/emitter.c b/emitter.c index 7509186dc0ae59f54c5889f525c6c6ee27a70873..05c152f24d1128ea71d6d453081ea208e7e3abf0 100644 --- a/emitter.c +++ b/emitter.c @@ -12,8 +12,7 @@ #include -static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */ -static struct timespec MAX_SLEEP = { 15, 0 }; /* 15 */ +#include "sleepdefs.h" void *emitter(void *arg) { struct emitter_config *config = arg; diff --git a/harvester.c b/harvester.c index 0f040bf83d822dd37d3e3a0716f29a9c08903a32..d0f17c4bfc303706a0f6ddc18d8972a10a4f3580 100644 --- a/harvester.c +++ b/harvester.c @@ -14,6 +14,7 @@ #include "harvester.h" #include "backoff.h" #include "insist.h" +#include "sleepdefs.h" #ifdef __MACH__ /* OS X is dumb, or I am dumb, or we are both dumb. I don't know anymore, @@ -26,9 +27,6 @@ extern int gethostname(char *name, size_t namelen); #define EMITTER_SOCKET "inproc://emitter" #define BUFFERSIZE 16384 -static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */ -static struct timespec MAX_SLEEP = { 15, 0 }; /* 15 */ - /* A free function that simply calls free(3) for zmq_msg */ //static inline void free2(void *data, void __attribute__((__unused__)) *hint) { //free(data); diff --git a/proto.c b/proto.c index bd4a2f6508352482a294afdc913660970565b38a..dd588ba155d37b7a5f6ffe1cdac927809858c42a 100644 --- a/proto.c +++ b/proto.c @@ -20,8 +20,7 @@ #include "openssl/ssl.h" #include "openssl/err.h" -static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */ -static struct timespec MAX_SLEEP = { 15, 0 }; /* 15 */ +#include "sleepdefs.h" static void lumberjack_init(void); static int lumberjack_tcp_connect(struct lumberjack *lumberjack); diff --git a/sleepdefs.h b/sleepdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..4647d7ff9984c34fd58d1fafae80dcf0480b7e70 --- /dev/null +++ b/sleepdefs.h @@ -0,0 +1,5 @@ +#ifndef _SLEEPDEFS_H_ +#define _SLEEPDEFS_H_ +static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */ +static struct timespec MAX_SLEEP = { 1, 0 }; /* 15 */ +#endif /* _SLEEPDEFS_H_ */