weechat-xmpp/Makefile

78 lines
2.2 KiB
Makefile
Raw Normal View History

2018-04-29 21:26:14 +00:00
CC=clang
2018-05-06 00:09:58 +00:00
CXX=g++
2018-04-29 21:26:14 +00:00
RM=rm -f
2018-05-09 12:40:23 +00:00
ifdef DEBUG
SANCFLAGS=-fsanitize=address -fsanitize=leak
SANLDFLAGS=-static-libasan -static-liblsan
endif
2018-05-09 12:16:20 +00:00
CFLAGS=$(SANCFLAGS) -fno-omit-frame-pointer -fPIC -std=gnu99 -g -Wall -Wextra -Werror-implicit-function-declaration -Wno-missing-field-initializers -Ilibwebsockets/include -Ijson-c
2018-05-06 00:09:58 +00:00
LDFLAGS=-shared -g $(SANCFLAGS) $(SANLDFLAGS)
LDLIBS=-lgnutls
2018-04-29 21:26:14 +00:00
SRCS=slack.c \
2018-05-01 10:23:37 +00:00
slack-api.c \
slack-buffer.c \
2018-05-02 07:11:57 +00:00
slack-channel.c \
2018-04-29 21:26:14 +00:00
slack-config.c \
slack-command.c \
2018-05-01 10:23:37 +00:00
slack-input.c \
2018-05-04 00:31:06 +00:00
slack-message.c \
2018-04-29 21:26:14 +00:00
slack-oauth.c \
2018-05-02 07:11:57 +00:00
slack-request.c \
2018-05-01 10:23:37 +00:00
slack-teaminfo.c \
2018-05-02 07:11:57 +00:00
slack-user.c \
slack-workspace.c \
api/slack-api-hello.c \
api/slack-api-error.c \
2018-05-02 22:16:20 +00:00
api/slack-api-message.c \
2018-05-06 00:09:58 +00:00
api/slack-api-user-typing.c \
2018-05-08 21:02:17 +00:00
api/message/slack-api-message-bot-message.c \
2018-05-08 22:34:46 +00:00
api/message/slack-api-message-slackbot-response.c \
2018-05-09 16:35:55 +00:00
api/message/slack-api-message-me-message.c \
2018-05-02 22:16:20 +00:00
api/message/slack-api-message-unimplemented.c \
2018-05-04 00:31:06 +00:00
request/slack-request-chat-postmessage.c \
2018-05-02 07:11:57 +00:00
request/slack-request-channels-list.c \
2018-05-07 17:08:34 +00:00
request/slack-request-conversations-members.c \
2018-05-02 07:11:57 +00:00
request/slack-request-users-list.c
2018-04-29 21:26:14 +00:00
OBJS=$(subst .c,.o,$(SRCS)) libwebsockets/lib/libwebsockets.a json-c/libjson-c.a
2018-05-01 10:23:37 +00:00
all: libwebsockets/lib/libwebsockets.a json-c/libjson-c.a weechat-slack
2018-04-29 21:26:14 +00:00
weechat-slack: $(OBJS)
2018-05-06 00:09:58 +00:00
$(CXX) $(LDFLAGS) -o slack.so $(OBJS) $(LDLIBS)
2018-04-29 21:26:14 +00:00
libwebsockets/lib/libwebsockets.a:
2018-05-01 10:23:37 +00:00
cd libwebsockets && cmake -DLWS_STATIC_PIC=ON -DLWS_WITH_SHARED=OFF -DLWS_WITHOUT_TESTAPPS=ON -DLWS_WITH_LIBEV=OFF -DLWS_WITH_LIBUV=OFF -DLWS_WITH_LIBEVENT=OFF -DCMAKE_BUILD_TYPE=DEBUG .
2018-04-29 21:26:14 +00:00
$(MAKE) -C libwebsockets
json-c/libjson-c.a:
cd json-c && cmake -DCMAKE_C_FLAGS=-fPIC .
$(MAKE) -C json-c json-c-static
depend: .depend
2018-05-09 12:26:51 +00:00
.depend: libwebsockets/lib/libwebsockets.a json-c/libjson-c.a $(SRCS)
2018-04-29 21:26:14 +00:00
$(RM) ./.depend
$(CC) $(CFLAGS) -MM $^>>./.depend;
clean:
$(RM) $(OBJS)
$(MAKE) -C libwebsockets clean
$(MAKE) -C json-c clean
distclean: clean
$(RM) *~ .depend
2018-05-07 17:08:34 +00:00
install: slack.so
2018-05-09 13:18:30 +00:00
install -t ~/.weechat/plugins -D slack.so
2018-05-07 17:08:34 +00:00
2018-05-04 00:31:06 +00:00
.PHONY: tags cs
tags:
2018-05-09 00:57:17 +00:00
$(CC) $(CFLAGS) -M $(SRCS) | sed -e "s/[\\ ]/\n/g" | sed -e "/^$$/d" -e "/\.o:[ \t]*$$/d" | sort | uniq | ctags -e -L - -f .git/tags -R --c-kinds=+px --c++-kinds=+px --fields=+iaS --extra=+fq
2018-05-08 21:02:17 +00:00
2018-05-04 00:31:06 +00:00
cs:
cscope -RUbq
2018-04-29 21:26:14 +00:00
include .depend