weechat-xmpp/Makefile

95 lines
2.9 KiB
Makefile
Raw Normal View History

2018-05-09 12:40:23 +00:00
ifdef DEBUG
2018-05-10 14:40:10 +00:00
CC=clang
CXX=g++
DBGCFLAGS=-fsanitize=address -fsanitize=leak
DBGLDFLAGS=-static-libasan -static-liblsan
2018-05-09 12:40:23 +00:00
endif
2018-05-10 14:40:10 +00:00
RM=rm -f
CFLAGS+=$(DBGCFLAGS) -fno-omit-frame-pointer -fPIC -std=gnu99 -g -Wall -Wextra -Werror-implicit-function-declaration -Wno-missing-field-initializers -Ilibwebsockets/include -Ijson-c
LDFLAGS+=-shared -g $(DBGCFLAGS) $(DBGLDFLAGS)
LDLIBS=-lgnutls
2018-04-29 21:26:14 +00:00
2018-05-10 14:40:10 +00:00
PREFIX ?= /usr/local
LIBDIR ?= $(PREFIX)/lib
INSTALL ?= /usr/bin/install
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 \
request/slack-request-chat-memessage.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-10 14:40:10 +00:00
cd libwebsockets && env CFLAGS= LDFLAGS= 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:
2018-05-10 14:40:10 +00:00
cd json-c && env CFLAGS= LDFLAGS= cmake -DCMAKE_C_FLAGS=-fPIC .
2018-04-29 21:26:14 +00:00
$(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
2018-05-10 14:40:10 +00:00
git submodule foreach --recursive git clean -xfd || true
git submodule foreach --recursive git reset --hard || true
git submodule update --init --recursive || true
2018-04-29 21:26:14 +00:00
distclean: clean
$(RM) *~ .depend
2018-05-07 17:08:34 +00:00
install: slack.so
2018-05-10 14:40:10 +00:00
ifeq ($(shell id -u),0)
$(INSTALL) -s -t $(DESTDIR)$(LIBDIR)/weechat/plugins -D -m 0755 slack.so
else
$(INSTALL) -s -t ~/.weechat/plugins -D -m 0755 slack.so
endif
package-debian:
env ARCH=i386 gbp buildpackage --git-arch=i386 --git-ignore-new --git-pbuilder
env ARCH=amd64 gbp buildpackage --git-arch=amd64 --git-ignore-new --git-pbuilder
# gbp buildpackage -S --git-ignore-new
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