diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-01-03 12:45:37 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-01-03 12:45:37 +0000 |
commit | 9ac2c979fb25e57c2a8aab81de7fe0d427a437dc (patch) | |
tree | 16a154eb8f0786d7116bbf2f0cb0090da38fcc84 | |
parent | 277ce56307aad8b5627baaf1766c9d931bf7560e (diff) | |
download | purple-matrix-9ac2c979fb25e57c2a8aab81de7fe0d427a437dc.tar.gz |
Factor out common parts of Makefile and Makefile.mingw
-rw-r--r-- | Makefile | 32 | ||||
-rw-r--r-- | Makefile.common | 41 | ||||
-rw-r--r-- | Makefile.mingw | 36 |
3 files changed, 45 insertions, 64 deletions
@@ -4,42 +4,14 @@ CC=gcc LIBS=purple json-glib-1.0 glib-2.0 PKG_CONFIG=pkg-config -CFLAGS+=-DPURPLE_PLUGINS $(shell $(PKG_CONFIG) --cflags $(LIBS)) +CFLAGS+=$(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) +include Makefile.common diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 0000000..05dc040 --- /dev/null +++ b/Makefile.common @@ -0,0 +1,41 @@ +# common parts of Makefile and Makefile.mingw + +COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c + +CFLAGS+=-Wall -g -O0 -Werror +CFLAGS += -DPURPLE_PLUGINS + +# 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 + +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 $@ + +%.o: %.c + $(COMPILE.c) $(OUTPUT_OPTION) $< + +-include $(OBJECTS:.o=.d) + +# Local Variables: +# mode: makefile +# End: diff --git a/Makefile.mingw b/Makefile.mingw index 15e0bec..1745354 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -1,6 +1,5 @@ #!/usr/bin/make -f - PIDGIN_TREE_TOP ?= ../pidgin-2.10.12 WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev GLIB_TOP ?= $(WIN32_DEV_TOP)/gtk2-2.28 @@ -9,44 +8,13 @@ HTTP_PARSER_TOP ?= $(WIN32_DEV_TOP)/http-parser-2.6.0 CC := $(WIN32_DEV_TOP)/mingw/bin/gcc.exe -CFLAGS += -DPURPLE_PLUGINS -I$(PIDGIN_TREE_TOP)/libpurple -I$(JSON_GLIB_TOP)/include/json-glib-1.0 -I$(GLIB_TOP)/include/glib-2.0 -I$(GLIB_TOP)/lib/glib-2.0/include -I$(HTTP_PARSER_TOP) -CFLAGS += -Wall -g -O0 -Werror +CFLAGS += -I$(PIDGIN_TREE_TOP)/libpurple -I$(JSON_GLIB_TOP)/include/json-glib-1.0 -I$(GLIB_TOP)/include/glib-2.0 -I$(GLIB_TOP)/lib/glib-2.0/include -I$(HTTP_PARSER_TOP) LDLIBS += -L$(PIDGIN_TREE_TOP)/libpurple -lpurple -L$(JSON_GLIB_TOP)/lib -ljson-glib-1.0 -L$(GLIB_TOP)/bin -lglib-2.0-0 -lgobject-2.0-0 LDLIBS += -L$(HTTP_PARSER_TOP) -lhttp_parser -static-libgcc PLUGIN_DIR_PURPLE = "C:\Program Files (x86)\Pidgin\plugins" DATA_ROOT_DIR_PURPLE = "C:\Program Files (x86)\Pidgin" - -# 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.dll -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 - - -%.o: %.c - $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< - -$(TARGET): $(OBJECTS) - $(LINK.o) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ - --include $(OBJECTS:.o=.d) +include Makefile.common |