weechat-xmpp/Makefile

62 lines
1.4 KiB
Makefile
Raw Normal View History

2018-05-09 12:40:23 +00:00
ifdef DEBUG
DBGCFLAGS=-fsanitize=address -fsanitize=leak -fsanitize=undefined
DBGLDFLAGS=-static-libasan -static-liblsan -static-libubsan
2018-05-09 12:40:23 +00:00
endif
2018-05-10 14:40:10 +00:00
RM=rm -f
FIND=find
2021-06-28 01:18:05 +00:00
INCLUDES=-Ilibstrophe
2021-06-27 22:51:05 +00:00
CFLAGS+=$(DBGCFLAGS) -fno-omit-frame-pointer -fPIC -std=gnu99 -g -Wall -Wextra -Werror-implicit-function-declaration -Wno-missing-field-initializers $(INCLUDES)
2018-05-10 14:40:10 +00:00
LDFLAGS+=-shared -g $(DBGCFLAGS) $(DBGLDFLAGS)
2021-06-27 22:51:05 +00:00
LDLIBS=-lstrophe -lpthread
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
2021-06-28 01:17:02 +00:00
SRCS=plugin.c \
command.c \
config.c \
connection.c \
2021-06-25 22:20:49 +00:00
2021-06-28 01:18:05 +00:00
DEPS=
2021-06-27 22:51:05 +00:00
OBJS=$(subst .c,.o,$(SRCS))
all: $(DEPS) weechat-xmpp
2018-04-29 21:26:14 +00:00
2021-06-25 22:20:49 +00:00
weechat-xmpp: $(OBJS)
2021-06-26 01:31:45 +00:00
$(CC) $(LDFLAGS) -o xmpp.so $(OBJS) $(LDLIBS)
2021-06-27 22:51:05 +00:00
which patchelf >/dev/null && \
patchelf --set-rpath $(LIBRARY_PATH):$(shell patchelf --print-rpath xmpp.so) xmpp.so || true
2018-04-29 21:26:14 +00:00
depend: .depend
2021-06-28 01:18:05 +00:00
.depend: $(SRCS)
2018-04-29 21:26:14 +00:00
$(RM) ./.depend
$(CC) $(CFLAGS) -MM $^>>./.depend
tidy:
$(FIND) . -name "*.o" -delete
2018-04-29 21:26:14 +00:00
clean:
$(RM) $(OBJS)
distclean: clean
$(RM) *~ .depend
2021-06-25 22:20:49 +00:00
install: xmpp.so
2018-05-10 14:40:10 +00:00
ifeq ($(shell id -u),0)
2021-06-25 22:20:49 +00:00
$(INSTALL) -s -t $(DESTDIR)$(LIBDIR)/weechat/plugins -D -m 0644 xmpp.so
2018-05-10 14:40:10 +00:00
else
2021-06-25 22:20:49 +00:00
$(INSTALL) -s -t ~/.weechat/plugins -D -m 0755 xmpp.so
2018-05-10 14:40:10 +00:00
endif
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