-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
102 lines (78 loc) · 4.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
PIDGIN_TREE_TOP ?= ../pidgin-2.10.12
PIDGIN3_TREE_TOP ?= ../pidgin-main
LIBPURPLE_DIR ?= $(PIDGIN_TREE_TOP)/libpurple
WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev
WIN32_CC ?= $(WIN32_DEV_TOP)/mingw/bin/gcc
PROTOC_C ?= protoc-c
PKG_CONFIG ?= pkg-config
REVISION_ID = $(shell git rev-parse --short HEAD)
REVISION_NUMBER = $(shell git rev-list --count HEAD)
ifneq ($(REVISION_ID),)
PLUGIN_VERSION ?= 0.9.$(shell date +%Y.%m.%d).git.r$(REVISION_NUMBER).$(REVISION_ID)
else
PLUGIN_VERSION ?= 0.9.$(shell date +%Y.%m.%d)
endif
CFLAGS ?= -O2 -g -pipe -Wall -DYAHOO_PLUGIN_VERSION='"$(PLUGIN_VERSION)"'
LDFLAGS ?= -Wl,-z,relro
# Do some nasty OS and purple version detection
ifeq ($(OS),Windows_NT)
YAHOO_TARGET = libyahoo-plusplus.dll
YAHOO_DEST = "$(PROGRAMFILES)/Pidgin/plugins"
YAHOO_ICONS_DEST = "$(PROGRAMFILES)/Pidgin/pixmaps/pidgin/protocols"
else
UNAME_S := $(shell uname -s)
#.. There are special flags we need for OSX
ifeq ($(UNAME_S), Darwin)
#
#.. /opt/local/include and subdirs are included here to ensure this compiles
# for folks using Macports. I believe Homebrew uses /usr/local/include
# so things should "just work". You *must* make sure your packages are
# all up to date or you will most likely get compilation errors.
#
INCLUDES = -I/opt/local/include -lz $(OS)
CC = gcc
else
CC ?= gcc
endif
ifeq ($(shell $(PKG_CONFIG) --exists purple-3 2>/dev/null && echo "true"),)
ifeq ($(shell $(PKG_CONFIG) --exists purple 2>/dev/null && echo "true"),)
YAHOO_TARGET = FAILNOPURPLE
YAHOO_DEST =
YAHOO_ICONS_DEST =
else
YAHOO_TARGET = libyahoo-plusplus.so
YAHOO_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=plugindir purple`
YAHOO_ICONS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple`/pixmaps/pidgin/protocols
endif
else
YAHOO_TARGET = libyahoo-plusplus3.so
YAHOO_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=plugindir purple-3`
YAHOO_ICONS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple-3`/pixmaps/pidgin/protocols
endif
endif
WIN32_CFLAGS = -I$(WIN32_DEV_TOP)/glib-2.28.8/include -I$(WIN32_DEV_TOP)/glib-2.28.8/include/glib-2.0 -I$(WIN32_DEV_TOP)/glib-2.28.8/lib/glib-2.0/include -I$(WIN32_DEV_TOP)/json-glib-0.14/include/json-glib-1.0 -DENABLE_NLS -DYAHOO_PLUGIN_VERSION='"$(PLUGIN_VERSION)"' -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-parameter -fno-strict-aliasing -Wformat
WIN32_LDFLAGS = -L$(WIN32_DEV_TOP)/glib-2.28.8/lib -L$(WIN32_DEV_TOP)/json-glib-0.14/lib -lpurple -lintl -lglib-2.0 -lgobject-2.0 -ljson-glib-1.0 -g -ggdb -static-libgcc -lz
WIN32_PIDGIN2_CFLAGS = -I$(PIDGIN_TREE_TOP)/libpurple -I$(PIDGIN_TREE_TOP) $(WIN32_CFLAGS)
WIN32_PIDGIN3_CFLAGS = -I$(PIDGIN3_TREE_TOP)/libpurple -I$(PIDGIN3_TREE_TOP) -I$(WIN32_DEV_TOP)/gplugin-dev/gplugin $(WIN32_CFLAGS)
WIN32_PIDGIN2_LDFLAGS = -L$(PIDGIN_TREE_TOP)/libpurple $(WIN32_LDFLAGS)
WIN32_PIDGIN3_LDFLAGS = -L$(PIDGIN3_TREE_TOP)/libpurple -L$(WIN32_DEV_TOP)/gplugin-dev/gplugin $(WIN32_LDFLAGS) -lgplugin
C_FILES :=
PURPLE_COMPAT_FILES := purple2compat/http.c purple2compat/purple-socket.c
PURPLE_C_FILES := libyahoo-plusplus.c $(C_FILES)
.PHONY: all install FAILNOPURPLE clean
all: $(YAHOO_TARGET)
libyahoo-plusplus.so: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
$(CC) -fPIC $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) `$(PKG_CONFIG) purple glib-2.0 json-glib-1.0 --libs --cflags` $(INCLUDES) -Ipurple2compat -g -ggdb
libyahoo-plusplus3.so: $(PURPLE_C_FILES)
$(CC) -fPIC $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) `$(PKG_CONFIG) purple-3 glib-2.0 json-glib-1.0 --libs --cflags` $(INCLUDES) -g -ggdb
libyahoo-plusplus.dll: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
$(WIN32_CC) -shared -o $@ $^ $(WIN32_PIDGIN2_CFLAGS) $(WIN32_PIDGIN2_LDFLAGS) -Ipurple2compat
libyahoo-plusplus3.dll: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
$(WIN32_CC) -shared -o $@ $^ $(WIN32_PIDGIN3_CFLAGS) $(WIN32_PIDGIN3_LDFLAGS)
install: $(YAHOO_TARGET)
mkdir -p $(YAHOO_DEST)
install -p $(YAHOO_TARGET) $(YAHOO_DEST)
FAILNOPURPLE:
echo "You need libpurple development headers installed to be able to compile this plugin"
clean:
rm -f $(YAHOO_TARGET)