OBS: sync with latest versions
[siplcs.git] / src / core / Makefile.mingw
blobf5cf3b0a9789aebc083583bb11bfebca21d13737
1 ################################### tell Emacs this is a -*- makefile-gmake -*-
3 # Copyright (C) 2011-2013 SIPE Project <http://sipe.sourceforge.net/>
5 # Makefile.mingw
7 # Author: zup@sbox.tugraz.at
8 # Date 8/28/07
9 # Description: Makefile for win32 (mingw) version of libsipe
11 ###############################################################################
13 # Configuration option:
14 #  - USE_SSPI defined:     NTLM, Kerberos, TLS-DSK & Single Sign-On supported
15 #  - USE_SSPI not defined: NTLM & TLS-DSK but without Single Sign-On support
16 #             [eg.: make -f Makefile.mingw USE_SSPI= ]
18 # @TODO: HAVE_GSSAPI_GSSAPI_H support for USE_SSPI=. Where to find the libraries?
19 #        Those would need to be packaged alongside the plugin.
21 USE_SSPI := 1
23 ifdef PIDGIN_TREE_TOP
24 # standalone MinGW build
25 OLD_PIDGIN_TREE_TOP := $(PIDGIN_TREE_TOP)
26 PIDGIN_TREE_TOP     := ../$(OLD_PIDGIN_TREE_TOP)
27 else
28 # MinGW cross-compile build (see contrib/mingw-cross-compile/README.txt)
29 PIDGIN_TREE_TOP := ../../..
30 VERSION         := $(shell cat ../../VERSION)
31 endif
33 include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
35 TARGET = libsipe
37 DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR)
39 # dump higher level defines
40 DEFINES  =
41 DEFINES += -DENABLE_NLS=1
42 DEFINES += -DPACKAGE_BUGREPORT=\"https://sourceforge.net/p/sipe/bugs/\"
43 DEFINES += -DPACKAGE_NAME=\"pidgin-sipe\"
44 DEFINES += -DPACKAGE_URL=\"http://sipe.sourceforge.net/\"
45 DEFINES += -DPACKAGE_VERSION=\"$(VERSION)\"
46 DEFINES += -DSIPE_TRANSLATIONS_URL=\"https://www.transifex.com/projects/p/pidgin-sipe/r/mob/\"
47 #DEFINES += -DENABLE_OCS2005_MESSAGE_HACK=1
49 ifdef USE_SSPI
50 DEFINES += -DHAVE_SSPI=1
51 endif
54 ## INCLUDE PATHS
56 INCLUDE_PATHS +=        -I. \
57                         -I../api \
58                         -I../purple \
59                         -I$(GTK_TOP)/include \
60                         -I$(GTK_TOP)/include/glib-2.0 \
61                         -I$(GTK_TOP)/lib/glib-2.0/include \
62                         -I$(LIBXML2_TOP)/include/libxml2 \
63                         -I$(NSPR_TOP)/include \
64                         -I$(NSS_TOP)/include
66 PURPLE_INCLUDE_PATHS += -I$(PURPLE_TOP) \
67                         -I$(PURPLE_TOP)/win32 \
68                         -I$(PIDGIN_TREE_TOP)
71 ##  SOURCES, OBJECTS
73 CLEAN_C_SRC =           sip-soap.c \
74                         sip-transport.c \
75                         sipe-conf.c \
76                         sipe-core.c \
77                         sipe-domino.c \
78                         sipe-buddy.c \
79                         sipe-cal.c \
80                         sipe-certificate.c \
81                         sipe-cert-crypto-nss.c \
82                         sipe-chat.c \
83                         sipe-crypt-nss.c \
84                         sipe-dialog.c \
85                         sipe-digest-nss.c \
86                         sipe-ft.c \
87                         sipe-ft-tftp.c \
88                         sipe-group.c \
89                         sipe-groupchat.c \
90                         sipe-http.c \
91                         sipe-http-request.c \
92                         sipe-http-transport.c \
93                         sipe-im.c \
94                         sipe-incoming.c \
95                         sipe-notify.c \
96                         sipe-ocs2005.c \
97                         sipe-ocs2007.c \
98                         sipe-schedule.c \
99                         sipe-session.c \
100                         sipe-status.c \
101                         sipe-subscriptions.c \
102                         sipe-svc.c \
103                         sipe-tls.c \
104                         sipe-ucs.c \
105                         sipe-user.c \
106                         sipe-utils.c \
107                         sipe-ews.c \
108                         sipe-ews-autodiscover.c \
109                         sipmsg.c \
110                         sipe-sign.c \
111                         sip-sec.c \
112                         sip-sec-basic.c \
113                         sip-sec-digest.c \
114                         sip-sec-tls-dsk.c \
115                         sip-csta.c \
116                         sipe-webticket.c \
117                         sipe-xml.c \
118                         uuid.c \
119                         sipe-win32dep.c
121 PURPLE_C_SRC =          ../purple/purple-buddy.c \
122                         ../purple/purple-chat.c \
123                         ../purple/purple-connection.c \
124                         ../purple/purple-debug.c \
125                         ../purple/purple-dnsquery.c \
126                         ../purple/purple-ft.c \
127                         ../purple/purple-groupchat.c \
128                         ../purple/purple-im.c \
129                         ../purple/purple-markup.c \
130                         ../purple/purple-mime.c \
131                         ../purple/purple-network.c \
132                         ../purple/purple-notify.c \
133                         ../purple/purple-plugin.c \
134                         ../purple/purple-schedule.c \
135                         ../purple/purple-search.c \
136                         ../purple/purple-setting.c \
137                         ../purple/purple-status.c \
138                         ../purple/purple-transport.c \
139                         ../purple/purple-user.c
141 C_TEST_SRC =            sipe-xml-tests.c
143 ifdef USE_SSPI
144 CLEAN_C_SRC +=          sip-sec-sspi.c
145 else
146 CLEAN_C_SRC +=          md4.c \
147                         sip-sec-ntlm.c
149 C_TEST_SRC +=           sip-sec-ntlm-tests.c \
150                         ../purple/tests.c
151 endif
153 C_SRC =                 $(CLEAN_C_SRC) $(PURPLE_C_SRC)
155 RC_SRC =                libsiperc.rc
157 CLEAN_OBJECTS =         $(CLEAN_C_SRC:%.c=%.o)
158 PURPLE_OBJECTS =        $(PURPLE_C_SRC:%.c=%.o)
159 RC_OBJECTS =            $(RC_SRC:%.rc=%.o)
160 OBJECTS =               $(CLEAN_OBJECTS) $(PURPLE_OBJECTS) $(RC_OBJECTS)
162 # Only these modules need the purple headers
163 $(PURPLE_OBJECTS):      INCLUDE_PATHS += $(PURPLE_INCLUDE_PATHS)
165 TEST_OBJECTS =          $(C_TEST_SRC:%.c=%.o)
168 ## LIBRARIES
170 LIB_PATHS =             -L$(GTK_TOP)/lib \
171                         -L$(LIBXML2_TOP)/lib \
172                         -L$(NSS_TOP)/lib \
173                         -L$(PURPLE_TOP)
175 LIBS =                  -lglib-2.0 \
176                         -lgobject-2.0 \
177                         -lintl \
178                         -lxml2 \
179                         -lnss3 \
180                         -lsmime3 \
181                         -lnspr4 \
182                         -lws2_32 \
183                         -lpurple
185 ifdef USE_SSPI
186 LIBS +=                 -lsecur32
187 endif
189 # These flags are used in mingw build
190 TESTS_WARN = -Werror -Wall -Wextra -Waggregate-return -Wcast-align -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
192 include $(PIDGIN_COMMON_RULES)
195 ## TARGET DEFINITIONS
197 .PHONY: all clean install
199 all: $(TARGET).dll
201 _comma = ,
203 libsiperc.rc: libsiperc.rc.in
204         sed \
205                 -e 's/@SIPE_VERSION@/$(VERSION)/' \
206                 -e 's/#SIPE_VERSION#/$(subst .,$(_comma),$(VERSION))/' \
207                 <$< >$@
209 $(OBJECTS): $(PURPLE_CONFIG_H)
211 $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS)
212         $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll
215 ## CLEAN RULES
217 clean: tests-clean
218         rm -f $(RC_SRC)
219         rm -f $(OBJECTS)
220         rm -f $(TARGET).dll
222 rmbak:
223         rm -f *~
225 install:
226         test -z "$(DLL_INSTALL_DIR)" || mkdir -p "$(DLL_INSTALL_DIR)"
227         /usr/bin/install -c $(TARGET).dll '$(DLL_INSTALL_DIR)'
229 $(TEST_OBJECTS):
231 tests: tests-clean $(TEST_OBJECTS)
232         $(CC) sipe-utils.o uuid.o sipe-xml.o sipe-xml-tests.o -L. $(LIB_PATHS) $(LIBS) -lsipe -o sipe-xml-tests.exe
233         ./sipe-xml-tests.exe
234 ifdef USE_SSPI
235 # nothing to do
236 else
237         $(CC) ../purple/purple-debug.o ../purple/purple-markup.o ../purple/purple-network.o md4.o sipe-digest.o sipe-crypt.o sipe-mime.o sipe-sign.o sipmsg.o sipe-utils.o uuid.o sip-sec-ntlm-tests.o ../purple/tests.o  -L. $(LIB_PATHS) $(LIBS) -lsipe -o ../purple/tests.exe
238         ../purple/tests.exe
239 endif
241 tests-clean:
242         rm -f $(TEST_OBJECTS)
243         rm -f sipe-xml-tests.exe ../purple/tests.exe
245 include $(PIDGIN_COMMON_TARGETS)