1#
2# global.mak
3#
4# This file should be included by all Makefile.mingw files for project
5# wide definitions (after correctly defining PIDGIN_TREE_TOP).
6#
7
8#include optional $(PIDGIN_TREE_TOP)/local.mak to allow overriding of any definitions
9-include $(PIDGIN_TREE_TOP)/local.mak
10
11ABS_TOP_SRCDIR := $(shell realpath $(PIDGIN_TREE_TOP))
12# in case we ever do separate build directories
13ABS_TOP_BUILDDIR := $(ABS_TOP_SRCDIR)
14
15# Locations of our various dependencies
16WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev
17GTKSPELL_TOP ?= $(WIN32_DEV_TOP)/gtkspell-2.0.16
18ENCHANT_TOP ?= $(WIN32_DEV_TOP)/enchant_1.6.0_win32
19GTK_TOP ?= $(WIN32_DEV_TOP)/gtk_2_0-2.14
20GTK_BIN ?= $(GTK_TOP)/bin
21LIBXML2_TOP ?= $(WIN32_DEV_TOP)/libxml2-2.9.2_daa1
22MEANWHILE_TOP ?= $(WIN32_DEV_TOP)/meanwhile-1.0.2_daa3
23NSS_TOP ?= $(WIN32_DEV_TOP)/nss-3.24-nspr-4.12
24PERL_LIB_TOP ?= $(WIN32_DEV_TOP)/perl-5.20.1.1
25SILC_TOOLKIT ?= $(WIN32_DEV_TOP)/silc-toolkit-1.1.12
26GSTREAMER_TOP ?= $(WIN32_DEV_TOP)/gstreamer-0.10.13
27GCC_SSP_TOP ?= $(shell dirname $(shell which $(CC)))
28CYRUS_SASL_TOP ?= $(WIN32_DEV_TOP)/cyrus-sasl-2.1.26_daa1
29
30# Where we installing this stuff to?
31PIDGIN_INSTALL_DIR := $(PIDGIN_TREE_TOP)/win32-install-dir
32PURPLE_INSTALL_DIR := $(PIDGIN_TREE_TOP)/win32-install-dir
33PIDGIN_INSTALL_PLUGINS_DIR := $(PIDGIN_INSTALL_DIR)/plugins
34PIDGIN_INSTALL_PERL_DIR := $(PIDGIN_INSTALL_PLUGINS_DIR)/perl
35PURPLE_INSTALL_PLUGINS_DIR := $(PURPLE_INSTALL_DIR)/plugins
36PURPLE_INSTALL_PERL_DIR := $(PURPLE_INSTALL_PLUGINS_DIR)/perl
37PURPLE_INSTALL_PO_DIR := $(PURPLE_INSTALL_DIR)/locale
38
39# Important (enough) locations in our source code
40PURPLE_TOP := $(PIDGIN_TREE_TOP)/libpurple
41PURPLE_PLUGINS_TOP := $(PURPLE_TOP)/plugins
42PURPLE_PERL_TOP := $(PURPLE_PLUGINS_TOP)/perl
43PIDGIN_TOP := $(PIDGIN_TREE_TOP)/pidgin
44PIDGIN_PIXMAPS_TOP := $(PIDGIN_TOP)/pixmaps
45PIDGIN_PLUGINS_TOP := $(PIDGIN_TOP)/plugins
46PURPLE_PO_TOP := $(PIDGIN_TREE_TOP)/po
47PURPLE_PROTOS_TOP := $(PURPLE_TOP)/protocols
48
49# Locations of important (in-tree) build targets
50PIDGIN_CONFIG_H := $(PIDGIN_TREE_TOP)/config.h
51PURPLE_CONFIG_H := $(PIDGIN_TREE_TOP)/config.h
52PIDGIN_REVISION_H := $(PIDGIN_TREE_TOP)/package_revision.h
53PIDGIN_REVISION_RAW_TXT := $(PIDGIN_TREE_TOP)/package_revision_raw.txt
54PURPLE_PURPLE_H := $(PURPLE_TOP)/purple.h
55PURPLE_VERSION_H := $(PURPLE_TOP)/version.h
56PURPLE_DLL := $(PURPLE_TOP)/libpurple.dll
57PURPLE_PERL_DLL := $(PURPLE_PERL_TOP)/perl.dll
58PIDGIN_DLL := $(PIDGIN_TOP)/pidgin.dll
59PIDGIN_EXE := $(PIDGIN_TOP)/pidgin.exe
60PIDGIN_PORTABLE_EXE := $(PIDGIN_TOP)/pidgin-portable.exe
61
62GCCWARNINGS ?= -Waggregate-return -Wcast-align -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wextra -Wno-sign-compare -Wno-unused-parameter -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
63
64CC_HARDENING_OPTIONS ?= -Wstack-protector -fwrapv -fno-strict-overflow -Wno-missing-field-initializers -Wformat-security -fstack-protector-all --param ssp-buffer-size=1
65LD_HARDENING_OPTIONS ?= -Wl,--dynamicbase -Wl,--nxcompat
66
67
68# parse the version number from the configure.ac file if it is newer
69#m4_define([purple_major_version], [2])
70#m4_define([purple_minor_version], [0])
71#m4_define([purple_micro_version], [0])
72#m4_define([purple_version_suffix], [devel])
73PIDGIN_VERSION := $(shell \
74  if [ ! $(PIDGIN_TREE_TOP)/VERSION -nt $(PIDGIN_TREE_TOP)/configure.ac ]; then \
75    awk 'BEGIN {FS="[\\(\\)\\[\\]]"} /^m4_define..purple_(major|minor)_version/ {printf("%s.",$$5);} /^m4_define..purple_micro_version/ {printf("%s",$$5);} /^m4_define..purple_version_suffix/ {printf("%s",$$5); exit}' \
76      $(PIDGIN_TREE_TOP)/configure.ac > $(PIDGIN_TREE_TOP)/VERSION; \
77  fi; \
78  cat $(PIDGIN_TREE_TOP)/VERSION \
79)
80PURPLE_VERSION := $(PIDGIN_VERSION)
81PURPLE_MAJOR_VERSION := $(firstword $(subst ., ,$(PURPLE_VERSION)))
82
83ifdef EXTRAVERSION
84DISPLAY_VERSION := $(PIDGIN_VERSION)-$(EXTRAVERSION)
85else
86DISPLAY_VERSION := $(PIDGIN_VERSION)
87endif
88
89CYRUS_SASL ?= 1
90
91ifeq ($(CYRUS_SASL), 1)
92DEFINES += -DHAVE_CYRUS_SASL
93endif
94
95DEFINES += -DHAVE_CONFIG_H -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_WIN32_WINNT=0x501
96
97CFLAGS += -O2 -Wall $(GCCWARNINGS) $(CC_HARDENING_OPTIONS) -pipe -mms-bitfields -g
98
99# If not specified, dlls are built with the default base address of 0x10000000.
100# When loaded into a process address space a dll will be rebased if its base
101# address colides with the base address of an existing dll.  To avoid rebasing
102# we do the following.  Rebasing can slow down the load time of dlls and it
103# also renders debug info useless.
104DLL_LD_FLAGS += -Wl,--enable-auto-image-base -Wl,--enable-auto-import $(LD_HARDENING_OPTIONS) -lssp
105
106# Build programs
107ifeq "$(origin CC)" "default"
108  CC := gcc.exe
109endif
110GMSGFMT ?= $(WIN32_DEV_TOP)/gettext-0.17/bin/msgfmt.exe
111MAKENSIS ?= makensis.exe
112PERL ?= perl
113WINDRES ?= windres
114STRIP ?= strip
115INTLTOOL_MERGE ?= $(WIN32_DEV_TOP)/intltool_0.40.4-1_win32/bin/intltool-merge
116MONO_SIGNCODE ?= signcode
117GPG_SIGN ?= gpg
118
119PIDGIN_COMMON_RULES := $(PURPLE_TOP)/win32/rules.mak
120PIDGIN_COMMON_TARGETS := $(PURPLE_TOP)/win32/targets.mak
121MINGW_MAKEFILE := Makefile.mingw
122
123INSTALL_PIXMAPS ?= 1
124INSTALL_SSL_CERTIFICATES ?= 1
125