# skeleton-libpurple - A skeleton for developing libpurple plugins # Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com> # Copyright (C) 2016-2017 Eion Robb <eion@robbmob.com> # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # figure out the os and set the proper variables for it ifeq ($(OS),Windows_NT) # window PLUGIN_TARGET := $(PLUGIN_NAME
).dll
# set the platform cflags and libs PLATFORM_CFLAGS := $(PLUGIN_CFLAGS_WIN32
) PLATFORM_LIBS := $(PLUGIN_LIBS_WIN32
) # set the variables for windows that are usually populated by pkg-config CC ?= $(WIN32_DEV_TOP
)/mingw-4.7.2/bin/gcc
LIBPURPLE_PLUGIN_DIR := $(PROGRAMFILES
)/Pidgin/plugins
PLUGIN_PIXMAPSDIR := $(PROGRAMFILES
)/Pidgin/pixmaps/pidgin
-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
$(PIDGIN_TREE_TOP
)/libpurple
\ -L
$(WIN32_DEV_TOP
)/glib-2.28.8/lib
\ -L
$(PIDGIN_TREE_TOP
)/libpurple
\ PLUGIN_TARGET := $(PLUGIN_NAME
).so
UNAME_S := $(shell
uname
-s
) PLATFORM_CFLAGS := $(PLUGIN_CFLAGS_DARWIN
) PLATFORM_LIBS := $(PLUGIN_LIBS_DARWIN
) PLATFORM_CFLAGS := $(PLUGIN_CFLAGS_LINUX
) PLATFORM_LIBS := $(PLUGIN_LIBS_LINUX
) # set a bunch of variables if there weren't set already -Wall
-Wextra
-Werror
-Wformat
\ -Wno-deprecated-declarations
-Wno-unused-parameter
\ # pkg-config if necessary LIBPURPLE_PC_MODULE ?= purple
LIBPURPLE_CFLAGS ?= $(shell
$(PKG_CONFIG
) --cflags
$(LIBPURPLE_PC_MODULE
)) LIBPURPLE_LIBS ?= $(shell
$(PKG_CONFIG
) --libs
$(LIBPURPLE_PC_MODULE
)) LIBPURPLE_PLUGIN_DIR ?= $(shell
$(PKG_CONFIG
) --variable
=plugindir
$(LIBPURPLE_PC_MODULE
)) LIBPURPLE_DATA_DIR ?= $(shell
$(PKG_CONFIG
) --variable
=datadir
$(LIBPURPLE_PC_MODULE
)) LIBPURPLE_LIB_DIR ?= $(shell
$(PKG_CONFIG
) --variable
=libdir
$(LIBPURPLE_PC_MODULE
)) PLUGIN_PIXMAPSDIR := $(LIBPURPLE_DATA_DIR
)/pixmaps/pidgin
# Variables that are platform independent PLUGIN_OBJECTS := $(PLUGIN_SOURCES:%.c
=%.o
) -DDATADIR
=$(LIBPURPLE_DATA_DIR
) \ -DLIBDIR
=$(LIBPURPLE_LIB_DIR
) \ -DPIXMAPSDIR
=$(PLUGIN_PIXMAPSDIR
) \ -DPLUGIN_VERSION
=\"$(PLUGIN_VERSION
)\" # Generate a list of destination of the pixmaps to install INSTALLED_PIXMAPS := $(PLUGIN_PIXMAPS:%
=$(PLUGIN_PIXMAPSDIR
)/%
) # Generate a list of protocol icons based on their sizes. We need to stash # everything in a temp variable so that we can do the final substitution. INSTALLED_PROTOCOL_PIXMAPS := _PIXMAP_TEMP := $(subst
16,,
$(filter
%16.png,
$(PROTOCOL_PIXMAPS
))) INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%
=$(PLUGIN_PIXMAPSDIR
)/protocols/16/%
) _PIXMAP_TEMP := $(subst
22,,
$(filter
%22.png,
$(PROTOCOL_PIXMAPS
))) INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%
=$(PLUGIN_PIXMAPSDIR
)/protocols/22/%
) _PIXMAP_TEMP := $(subst
48,,
$(filter
%48.png,
$(PROTOCOL_PIXMAPS
))) INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%
=$(PLUGIN_PIXMAPSDIR
)/protocols/48/%
) _PIXMAP_TEMP := $(subst
scaled,,
$(filter
%scaled.svg,
$(PROTOCOL_PIXMAPS
))) INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%
=$(PLUGIN_PIXMAPSDIR
)/protocols/scaled/%
) .PHONY: all clean install uninstall rm
-f
$(PLUGIN_OBJECTS
) $(PLUGIN_TARGET
) $(CLEAN_FILES
) install: $(PLUGIN_TARGET) $(INSTALLED_PIXMAPS) $(INSTALLED_PROTOCOL_PIXMAPS) install
-D
$(PLUGIN_TARGET
) $(LIBPURPLE_PLUGIN_DIR
)/
$(PLUGIN_TARGET
) # This target will fulfill the dependency of the INSTALLED_PIXMAPS variable above $(PLUGIN_PIXMAPSDIR)/%: %
$(PLUGIN_PIXMAPSDIR)/protocols/16/%.png: %16.
png $(PLUGIN_PIXMAPSDIR)/protocols/22/%.png: %22.
png $(PLUGIN_PIXMAPSDIR)/protocols/48/%.png: %48.
png $(PLUGIN_PIXMAPSDIR)/protocols/scaled/%.svg: %
scaled.
svg rm
-f
$(LIBPURPLE_PLUGIN_DIR
)/
$(PLUGIN_TARGET
) rm
-f
$(INSTALLED_PIXMAPS
) $(INSTALLED_PROTOCOL_PIXMAPS
) %.o: %.
c $(MAKEFILE_LIST) $(CC
) $(CFLAGS
) $(ADDITIONAL_CFLAGS
) $(PLATFORM_CFLAGS
) $(LIBPURPLE_CFLAGS
) $(PLUGIN_CFLAGS
) -c
-o
$@ $<
$(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(PLUGIN_HEADERS) $(MAKEFILE_LIST) $(PLUGIN_DEPENDENCIES) $(CC
) -o
$@ -shared
$(PLUGIN_OBJECTS
) $(LDFLAGS
) $(PLUGIN_LIBS
) $(LIBS
) $(LIBPURPLE_LIBS
) $(PLATFORM_LIBS
) echo $(PROTOCOL_PIXMAPS_16
) echo $(PROTOCOL_PIXMAPS_22
) echo $(PROTOCOL_PIXMAPS_48
) echo $(PROTOCOL_PIXMAPS_SCALED
) echo $(INSTALLED_PROTOCOL_PIXMAPS
) echo $(PLUGIN_PIXMAPSDIR
)