2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
LIBNAME=librdkafka
|
2013-06-06 00:22:20 +04:00
|
|
|
LIBVER=1
|
2012-09-19 14:26:37 +04:00
|
|
|
|
2013-06-06 00:22:20 +04:00
|
|
|
DESTDIR?=/usr/local
|
2012-09-19 14:26:37 +04:00
|
|
|
|
2013-06-06 00:22:20 +04:00
|
|
|
SRCS= rdkafka.c rdkafka_broker.c rdkafka_msg.c rdkafka_topic.c \
|
|
|
|
rdkafka_defaultconf.c
|
|
|
|
SRCS+= rdcrc32.c rdgz.c rdaddr.c rdrand.c rdthread.c rdqueue.c rdlog.c
|
2013-09-06 01:44:23 +04:00
|
|
|
SRCS+= snappy.c
|
2013-06-06 00:22:20 +04:00
|
|
|
HDRS= rdkafka.h
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
OBJS= $(SRCS:.c=.o)
|
|
|
|
DEPS= ${OBJS:%.o=%.d}
|
|
|
|
|
|
|
|
CFLAGS+=-O2 -Wall -Werror -Wfloat-equal -Wpointer-arith -fPIC -I.
|
2013-06-06 00:22:20 +04:00
|
|
|
CFLAGS+=-g -rdynamic
|
2013-09-06 01:44:23 +04:00
|
|
|
# Enable iovecs in snappy
|
|
|
|
CFLAGS+=-DSG
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
# Profiling
|
|
|
|
#CFLAGS+=-O0
|
|
|
|
#CFLAGS += -pg
|
|
|
|
#LDFLAGS += -pg
|
|
|
|
|
2013-08-27 15:38:31 +04:00
|
|
|
LDFLAGS+=-g -fPIC
|
|
|
|
LIBS=-lpthread -lrt -lz -lc
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
.PHONY:
|
|
|
|
|
|
|
|
all: libs
|
|
|
|
|
2013-06-06 00:22:20 +04:00
|
|
|
libs: $(LIBNAME).so.$(LIBVER) $(LIBNAME).a
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -MD -MP $(CFLAGS) -c $<
|
|
|
|
|
2013-06-06 00:22:20 +04:00
|
|
|
|
|
|
|
$(LIBNAME).so.$(LIBVER): $(OBJS)
|
2013-08-27 15:38:31 +04:00
|
|
|
$(CC) -shared $(LDFLAGS) \
|
|
|
|
-Wl,-soname=$@ -Wl,--version-script=librdkafka.lds \
|
|
|
|
$(OBJS) -o $@ $(LIBS)
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
$(LIBNAME).a: $(OBJS)
|
|
|
|
$(AR) rcs $@ $(OBJS)
|
|
|
|
|
|
|
|
install:
|
2013-06-06 00:22:20 +04:00
|
|
|
if [ "$(DESTDIR)" != "/usr/local" ]; then \
|
|
|
|
DESTDIR="$(DESTDIR)/usr"; \
|
2013-07-09 01:11:40 +04:00
|
|
|
else \
|
|
|
|
DESTDIR="$(DESTDIR)" ; \
|
2013-06-06 00:22:20 +04:00
|
|
|
fi ; \
|
|
|
|
install -d $$DESTDIR/include/librdkafka $$DESTDIR/lib ; \
|
|
|
|
install -t $$DESTDIR/include/$(LIBNAME) $(HDRS) ; \
|
|
|
|
install -t $$DESTDIR/lib $(LIBNAME).a ; \
|
|
|
|
install -t $$DESTDIR/lib $(LIBNAME).so.$(LIBVER) ; \
|
|
|
|
(cd $$DESTDIR/lib && ln -sf $(LIBNAME).so.$(LIBVER) $(LIBNAME).so)
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
clean:
|
2013-06-06 00:22:20 +04:00
|
|
|
rm -f $(OBJS) $(DEPS) \
|
|
|
|
$(LIBNAME)*.a $(LIBNAME)*.so $(LIBNAME)*.so.$(LIBVER)
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
-include $(DEPS)
|