grim/purple-spasm
Clone
Summary
Browse
Changes
Graph
Add a README.md and a few tweaks to libpurple.mk. Fixes #1
2017-04-27, Gary Kramlich
e429b51d0462
Add a README.md and a few tweaks to libpurple.mk. Fixes #1
#!/usr/bin/make -f
# 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)
# set the target's name
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
PLATFORM_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
$(
PIDGIN_TREE_TOP
)
/libpurple
\
-I
$(
PIDGIN_TREE_TOP
)
PLATFORM_LIBS
+=
\
-L
$(
WIN32_DEV_TOP
)
/glib-2.28.8/lib
\
-L
$(
PIDGIN_TREE_TOP
)
/libpurple
\
-lpurple
\
-lintl
\
-lglib-2.0
\
-lgobject-2.0
\
-lz
else
PLUGIN_TARGET
:=
$(
PLUGIN_NAME
)
.so
UNAME_S
:=
$(
shell
uname
-s
)
ifeq ($(UNAME_S),Darwin)
PLATFORM_CFLAGS
:=
$(
PLUGIN_CFLAGS_DARWIN
)
PLATFORM_LIBS
:=
$(
PLUGIN_LIBS_DARWIN
)
else
PLATFORM_CFLAGS
:=
$(
PLUGIN_CFLAGS_LINUX
)
PLATFORM_LIBS
:=
$(
PLUGIN_LIBS_LINUX
)
endif
endif
# set a bunch of variables if there weren't set already
CC
?=
gcc
CFLAGS
?=
-O2
-g
-g3
\
-Wall
-Wextra
-Werror
-Wformat
\
-Wno-deprecated-declarations
-Wno-unused-parameter
\
-fno-strict-aliasing
LDFLAGS
?=
# pkg-config if necessary
PKG_CONFIG
?=
pkg-config
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
))
# Variables that are platform independent
PLUGIN_OBJECTS
:=
$(
PLUGIN_SOURCES:%.c
=
%.o
)
ADDITIONAL_CFLAGS
:=
\
-DDATADIR
=
$(
LIBPURPLE_DATA_DIR
)
\
-DLIBDIR
=
$(
LIBPURPLE_LIB_DIR
)
\
-DPIXMAPSDIR
=
$(
LIBPURPLE_DATA_DIR
)
/pixmaps/pidgin
\
-DPLUGIN_VERSION
=
\"
$(
PLUGIN_VERSION
)
\"
# Build targets
.PHONY
:
all
clean
install
uninstall
all
:
$(
PLUGIN_TARGET
)
clean
:
rm
-f
$(
PLUGIN_OBJECTS
)
$(
PLUGIN_TARGET
)
$(
CLEAN_FILES
)
install
:
$(
PLUGIN_TARGET
)
install
-D
$(
PLUGIN_TARGET
)
$(
LIBPURPLE_PLUGIN_DIR
)
/
$(
PLUGIN_TARGET
)
uninstall
:
rm
-f
$(
LIBPURPLE_PLUGIN_DIR
)
/
$(
PLUGIN_TARGET
)
%.o
:
%.
c
$(
CC
)
$(
CFLAGS
)
$(
ADDITIONAL_CFLAGS
)
$(
PLATFORM_CFLAGS
)
$(
LIBPURPLE_CFLAGS
)
$(
PLUGIN_CFLAGS
)
-c
-o
$@
$<
$(PLUGIN_TARGET)
:
$(
PLUGIN_OBJECTS
)
$(
PLUGIN_HEADERS
)
$(
MAKEFILE_LIST
)
$(
PLUGIN_DEPENDENCIES
)
$(
CC
)
-shared
$(
LIBS
)
$(
LIBPURPLE_LIBS
)
$(
PLATFORM_LIBS
)
$(
LDFLAGS
)
$(
PLUGIN_LIBS
)
-o
$@
$(
PLUGIN_OBJECTS
)