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
|
|
|
|
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
|
2012-09-19 14:26:37 +04:00
|
|
|
|
|
|
|
# Profiling
|
|
|
|
#CFLAGS+=-O0
|
|
|
|
#CFLAGS += -pg
|
|
|
|
#LDFLAGS += -pg
|
|
|
|
|
|
|
|
LDFLAGS+=-shared -g -fPIC -lpthread -lrt -lz -lc
|
|
|
|
|
|
|
|
.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)
|
|
|
|
$(LD) -shared -soname $@ $(LDFLAGS) \
|
|
|
|
--version-script=librdkafka.lds \
|
|
|
|
$(OBJS) -o $@
|
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)
|