aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 9a6f9d098cd4860f919520fe2b73112168aed537 (plain) (blame)
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
#!/usr/bin/make -f

CC=gcc
LIBS=purple json-glib-1.0 glib-2.0

PKG_CONFIG=pkg-config
CFLAGS+=-DPURPLE_PLUGINS $(shell $(PKG_CONFIG) --cflags $(LIBS))
CFLAGS+=-fPIC -DPIC
CFLAGS+=-Wall -g -O0 -Werror
LDLIBS+=$(shell pkg-config --libs $(LIBS))
LDLIBS+=-lhttp_parser

PLUGIN_DIR_PURPLE	=  $(shell $(PKG_CONFIG) --variable=plugindir purple)
DATA_ROOT_DIR_PURPLE	=  $(shell $(PKG_CONFIG) --variable=datarootdir purple)


# generate .d files when compiling
CPPFLAGS+=-MMD

OBJECTS=libmatrix.o matrix-api.o matrix-connection.o \
    matrix-event.o \
    matrix-json.o \
    matrix-room.o \
    matrix-roommembers.o \
    matrix-statetable.o \
    matrix-sync.o
TARGET=libmatrix.so

all: $(TARGET)
clean:
	rm -f $(OBJECTS) $(OBJECTS:.o=.d) $(TARGET)

install:
	mkdir -p $(DESTDIR)$(PLUGIN_DIR_PURPLE)
	install -m 664 $(TARGET) $(DESTDIR)$(PLUGIN_DIR_PURPLE)
	for i in 16 22 48; do \
	    mkdir -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/$$i; \
	    install -m 664 matrix-$${i}px.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/$$i/matrix.png; \
	done


$(TARGET): $(OBJECTS)
	$(LINK.o) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@

-include $(OBJECTS:.o=.d)