You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.8 KiB
Makefile

ifdef DEBUG
DBGCFLAGS=-fsanitize=address -fsanitize=leak -fsanitize=undefined
DBGLDFLAGS=-static-libasan -static-liblsan -static-libubsan
endif
7 years ago
RM=rm -f
FIND=find
3 years ago
CFLAGS+=$(DBGCFLAGS) -fno-omit-frame-pointer -fPIC -std=gnu99 -g -Wall -Wextra -Werror-implicit-function-declaration -Wno-missing-field-initializers -Ilibstrophe -Ijson-c
7 years ago
LDFLAGS+=-shared -g $(DBGCFLAGS) $(DBGLDFLAGS)
3 years ago
LDLIBS=-lssl -lxml2
7 years ago
7 years ago
PREFIX ?= /usr/local
LIBDIR ?= $(PREFIX)/lib
INSTALL ?= /usr/bin/install
3 years ago
SRCS=xmpp.c \
3 years ago
xmpp-config.c \
3 years ago
OLDSRCS=slack.c \
slack-api.c \
slack-buffer.c \
slack-channel.c \
7 years ago
slack-config.c \
slack-command.c \
slack-completion.c \
slack-emoji.c \
slack-input.c \
slack-message.c \
7 years ago
slack-oauth.c \
slack-request.c \
slack-teaminfo.c \
slack-user.c \
slack-workspace.c \
api/slack-api-hello.c \
api/slack-api-error.c \
api/slack-api-message.c \
api/slack-api-user-typing.c \
7 years ago
api/message/slack-api-message-bot-message.c \
api/message/slack-api-message-slackbot-response.c \
api/message/slack-api-message-me-message.c \
api/message/slack-api-message-unimplemented.c \
request/slack-request-chat-memessage.c \
request/slack-request-chat-postmessage.c \
request/slack-request-channels-list.c \
7 years ago
request/slack-request-conversations-members.c \
request/slack-request-emoji-list.c \
request/slack-request-users-list.c
3 years ago
OBJS=$(subst .c,.o,$(SRCS)) libstrophe/.libs/libstrophe.a json-c/libjson-c.a
7 years ago
3 years ago
all: libstrophe/.libs/libstrophe.a json-c/libjson-c.a weechat-xmpp
7 years ago
3 years ago
weechat-xmpp: $(OBJS)
3 years ago
$(CC) $(LDFLAGS) -o xmpp.so $(OBJS) $(LDLIBS)
7 years ago
3 years ago
libstrophe/.libs/libstrophe.a:
3 years ago
cd libstrophe && ./bootstrap.sh && env CFLAGS=-fPIC LDFLAGS= ./configure
3 years ago
$(MAKE) -C libstrophe
libstrophe: libstrophe/.libs/libstrophe.a
7 years ago
json-c/libjson-c.a:
7 years ago
cd json-c && env CFLAGS= LDFLAGS= cmake -DCMAKE_C_FLAGS=-fPIC .
7 years ago
$(MAKE) -C json-c json-c-static
3 years ago
json-c: json-c/libjson-c.a
7 years ago
depend: .depend
3 years ago
.depend: libstrophe/.libs/libstrophe.a json-c/libjson-c.a $(SRCS)
7 years ago
$(RM) ./.depend
$(CC) $(CFLAGS) -MM $^>>./.depend
tidy:
$(FIND) . -name "*.o" -delete
7 years ago
clean:
$(RM) $(OBJS)
3 years ago
$(MAKE) -C libstrophe clean || true
$(MAKE) -C libwebsockets clean || true
$(MAKE) -C json-c clean || true
7 years ago
git submodule foreach --recursive git clean -xfd || true
git submodule foreach --recursive git reset --hard || true
git submodule update --init --recursive || true
7 years ago
distclean: clean
$(RM) *~ .depend
3 years ago
install: xmpp.so
7 years ago
ifeq ($(shell id -u),0)
3 years ago
$(INSTALL) -s -t $(DESTDIR)$(LIBDIR)/weechat/plugins -D -m 0644 xmpp.so
7 years ago
else
3 years ago
$(INSTALL) -s -t ~/.weechat/plugins -D -m 0755 xmpp.so
7 years ago
endif
.PHONY: tags cs
tags:
7 years ago
$(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
7 years ago
cs:
cscope -RUbq
7 years ago
include .depend