
This version still tries to load a PEM file, although libtgl --disable-openssl does not support it. Since there are several ways to resolve it, this switch away from OpenSSL and its solution should be different commits.
106 lines
3.6 KiB
Makefile
106 lines
3.6 KiB
Makefile
srcdir=@srcdir@
|
|
|
|
CFLAGS=@CFLAGS@ @PURPLE_CFLAGS@ @DEFS@ -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-parameter -I${srcdir} -I. -fno-strict-aliasing -fPIC
|
|
LDFLAGS=@LDFLAGS@ @PURPLE_LIBS@ @LIBS@ -rdynamic -ggdb
|
|
DIR_PERM=0755
|
|
FILE_PERM=0644
|
|
|
|
CC=@CC@
|
|
PKG_CONFIG=@PKG_CONFIG@
|
|
|
|
DEP=dep
|
|
EXE=bin
|
|
OBJ=objs
|
|
LIB=libs
|
|
DIR_LIST=${DEP} ${EXE} ${OBJ} ${LIB} ${DEP}/lodepng ${OBJ}/lodepng
|
|
|
|
PLUGIN_OBJECTS=${OBJ}/tgp-net.o ${OBJ}/tgp-timers.o ${OBJ}/msglog.o ${OBJ}/telegram-base.o ${OBJ}/telegram-purple.o ${OBJ}/tgp-2prpl.o ${OBJ}/tgp-structs.o ${OBJ}/tgp-utils.o ${OBJ}/tgp-chat.o ${OBJ}/tgp-ft.o ${OBJ}/tgp-msg.o ${OBJ}/tgp-request.o ${OBJ}/lodepng/lodepng.o
|
|
ALL_OBJS=${PLUGIN_OBJECTS}
|
|
|
|
.SUFFIXES:
|
|
|
|
.SUFFIXES: .c .h .o
|
|
|
|
PRPL_NAME=telegram-purple.so
|
|
PRPL_LIBNAME=${EXE}/${PRPL_NAME}
|
|
all: ${PRPL_LIBNAME}
|
|
|
|
PLUGIN_DIR_PURPLE=$(shell ${PKG_CONFIG} --variable=plugindir purple)
|
|
DATA_ROOT_DIR_PURPLE=$(shell ${PKG_CONFIG} --variable=datarootdir purple)
|
|
|
|
create_dirs: ${DIR_LIST}
|
|
|
|
${DIR_LIST}:
|
|
@test -d $@ || mkdir -p $@
|
|
|
|
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${ALL_OBJS}))
|
|
DEPENDENCE_LIST=${DEPENDENCE}
|
|
-include ${DEPENDENCE_LIST}
|
|
|
|
|
|
# The dependency on tgl/libs/libtgl.a ensures that "make -C tgl" was called,
|
|
# and most importantly: It ensures that all automatic headers exist.
|
|
${PLUGIN_OBJECTS}: ${OBJ}/%.o: ${srcdir}/%.c ${LIB}/libtgl.a | create_dirs
|
|
echo $@ && ${CC} ${CFLAGS} ${CPPFLAGS} -I ${srcdir}/tgl -I ${srcdir}/lodepng -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
|
|
|
tgl/Makefile.in:
|
|
@echo "tgl/Makefile.in not found. Maybe you need to 'git submodule update --init --recursive' ?" && exit 1
|
|
|
|
tgl/Makefile: tgl/Makefile.in
|
|
cd tgl && ./configure -q --disable-openssl
|
|
|
|
tgl/libs/libtgl.a: tgl/Makefile
|
|
+make -C tgl
|
|
|
|
${LIB}/libtgl.a: tgl/libs/libtgl.a | create_dirs
|
|
cp $< $@
|
|
|
|
${PRPL_LIBNAME}: ${PLUGIN_OBJECTS} ${LIB}/libtgl.a | create_dirs
|
|
${CC} -shared -o $@ $^ ${LDFLAGS}
|
|
|
|
|
|
|
|
.PHONY: plugin
|
|
plugin: $(PRPL_LIBNAME)
|
|
|
|
|
|
.PHONY: strip
|
|
strip: $(PRPL_LIBNAME)
|
|
$(STRIP) --strip-unneeded $(PRPL_LIBNAME)
|
|
|
|
.PHONY: install
|
|
install: $(PRPL_LIBNAME)
|
|
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(PLUGIN_DIR_PURPLE)
|
|
install -m $(FILE_PERM) $(PRPL_LIBNAME) $(DESTDIR)$(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
|
|
mkdir -m $(DIR_PERM) -p $(DESTDIR)/etc/telegram-purple
|
|
install -m $(FILE_PERM) tg-server.pub $(DESTDIR)/etc/telegram-purple/server.pub
|
|
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16
|
|
install -m $(FILE_PERM) imgs/telegram16.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
|
|
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22
|
|
install -m $(FILE_PERM) imgs/telegram22.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
|
|
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48
|
|
install -m $(FILE_PERM) imgs/telegram48.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
|
|
|
|
.PHONY: local_install
|
|
local_install:
|
|
install $(PRPL_LIBNAME) ${HOME}/.purple/plugins/$(PRPL_NAME)
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
rm -f $(DESTDIR)$(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
|
|
rm -f $(DESTDIR)/etc/telegram-purple/server.pub
|
|
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
|
|
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
|
|
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
|
|
rm -f ${HOME}/.purple/plugins/$(PRPL_NAME)
|
|
|
|
.PHONY: run
|
|
run:
|
|
pidgin -d | grep 'telegram\|plugin\|proxy'
|
|
|
|
.PHONY: debug
|
|
debug: install
|
|
ddd pidgin
|
|
|
|
clean:
|
|
rm -rf ${DIR_LIST} *.so *.a *.o telegram config.log config.status $(PRPL_C_OBJS) $(PRPL_LIBNAME) > /dev/null || echo "all clean"
|