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.

78 lines
1.8 KiB
Makefile

ifdef DEBUG
3 years ago
DBGCFLAGS=-fsanitize=address -fsanitize=undefined -fsanitize=leak
DBGLDFLAGS=-lasan -lubsan -llsan
endif
7 years ago
RM=rm -f
FIND=find
INCLUDES=-Ilibstrophe $(shell xml2-config --cflags)
CFLAGS+=$(DBGCFLAGS) -fno-omit-frame-pointer -fPIC -std=gnu99 -g -Wall -Wextra -Werror-implicit-function-declaration -Wno-missing-field-initializers $(INCLUDES)
3 years ago
LDFLAGS+=$(DBGLDFLAGS) -shared -g $(DBGCFLAGS)
LDLIBS=-lstrophe -lpthread $(shell xml2-config --libs)
7 years ago
7 years ago
PREFIX ?= /usr/local
LIBDIR ?= $(PREFIX)/lib
INSTALL ?= /usr/bin/install
3 years ago
SRCS=plugin.c \
3 years ago
account.c \
buffer.c \
channel.c \
command.c \
config.c \
connection.c \
input.c \
message.c \
user.c \
3 years ago
3 years ago
DEPS=
OBJS=$(subst .c,.o,$(SRCS))
3 years ago
all: weechat-xmpp
weechat-xmpp: $(DEPS) xmpp.so
7 years ago
3 years ago
xmpp.so: $(OBJS)
3 years ago
$(CC) $(LDFLAGS) -o xmpp.so $(OBJS) $(LDLIBS)
which patchelf >/dev/null && \
3 years ago
patchelf --set-rpath $(LIBRARY_PATH):$(shell realpath $(shell dirname $(shell gcc --print-libgcc-file-name))/../../../) xmpp.so && \
patchelf --shrink-rpath xmpp.so || true
test: xmpp.so
env LD_PRELOAD=$(DEBUG) \
3 years ago
weechat -a -P 'alias,buflist,irc' -r '/plugin load ./xmpp.so'
3 years ago
debug: xmpp.so
gdb -ex "handle SIGPIPE nostop noprint pass" --args \
weechat -a -r '/plugin load ./xmpp.so'
7 years ago
depend: .depend
3 years ago
.depend: $(SRCS)
7 years ago
$(RM) ./.depend
$(CC) $(CFLAGS) -MM $^>>./.depend
tidy:
$(FIND) . -name "*.o" -delete
7 years ago
clean:
$(RM) $(OBJS)
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