contrib: add NSIS to MinGW cross-compilation instructions
[siplcs.git] / src / core / Makefile.mingw
blob27b304b2a9ed7872f3ce6a5bb3e80b0fee9fb7e3
1 ################################### tell Emacs this is a -*- makefile-gmake -*-
3 # Copyright (C) 2011-12 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 & Single-Signon supported
15 #  - USE_SSPI not defined: only NTLM without Single-Signon supported
16 #             [eg.: make -f Makefile.mingw USE_SSPI= ]
18 USE_SSPI := 1
20 ifdef PIDGIN_TREE_TOP
21 # standalone MinGW build
22 OLD_PIDGIN_TREE_TOP := $(PIDGIN_TREE_TOP)
23 PIDGIN_TREE_TOP     := ../$(OLD_PIDGIN_TREE_TOP)
24 else
25 # MinGW cross-compile build (see contrib/mingw-cross-compile/README.txt)
26 PIDGIN_TREE_TOP := ../../..
27 VERSION         := $(shell cat ../../VERSION)
28 endif
30 include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
32 TARGET = libsipe
34 DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR)
36 # dump higher level defines
37 DEFINES  =
38 DEFINES += -DENABLE_NLS=1
39 DEFINES += -DPACKAGE_BUGREPORT=\"https://sourceforge.net/tracker/?atid=949931\&group_id=194563\"
40 DEFINES += -DPACKAGE_NAME=\"pidgin-sipe\"
41 DEFINES += -DPACKAGE_URL=\"http://sipe.sourceforge.net/\"
42 DEFINES += -DPACKAGE_VERSION=\"$(VERSION)\"
43 DEFINES += -DSIPE_TRANSLATIONS_URL=\"https://www.transifex.net/projects/p/pidgin-sipe/r/mob/\"
44 #DEFINES += -DENABLE_OCS2005_MESSAGE_HACK=1
46 ifdef USE_SSPI
47 DEFINES += -DHAVE_SSPI=1
48 endif
51 ## INCLUDE PATHS
53 INCLUDE_PATHS +=        -I. \
54                         -I../api \
55                         -I../purple \
56                         -I$(GTK_TOP)/include \
57                         -I$(GTK_TOP)/include/glib-2.0 \
58                         -I$(GTK_TOP)/lib/glib-2.0/include \
59                         -I$(LIBXML2_TOP)/include/libxml2 \
60                         -I$(NSPR_TOP)/include \
61                         -I$(NSS_TOP)/include
63 PURPLE_INCLUDE_PATHS += -I$(PURPLE_TOP) \
64                         -I$(PURPLE_TOP)/win32 \
65                         -I$(PIDGIN_TREE_TOP)
68 ##  SOURCES, OBJECTS
70 CLEAN_C_SRC =           http-conn.c \
71                         sip-soap.c \
72                         sip-transport.c \
73                         sipe-conf.c \
74                         sipe-core.c \
75                         sipe-domino.c \
76                         sipe-buddy.c \
77                         sipe-cal.c \
78                         sipe-certificate.c \
79                         sipe-cert-crypto-nss.c \
80                         sipe-chat.c \
81                         sipe-crypt-nss.c \
82                         sipe-dialog.c \
83                         sipe-digest-nss.c \
84                         sipe-ft.c \
85                         sipe-ft-tftp.c \
86                         sipe-group.c \
87                         sipe-groupchat.c \
88                         sipe-im.c \
89                         sipe-incoming.c \
90                         sipe-notify.c \
91                         sipe-ocs2005.c \
92                         sipe-ocs2007.c \
93                         sipe-schedule.c \
94                         sipe-session.c \
95                         sipe-status.c \
96                         sipe-subscriptions.c \
97                         sipe-svc.c \
98                         sipe-tls.c \
99                         sipe-user.c \
100                         sipe-utils.c \
101                         sipe-ews.c \
102                         sipmsg.c \
103                         sipe-sign.c \
104                         sip-sec.c \
105                         sip-csta.c \
106                         sipe-webticket.c \
107                         sipe-xml.c \
108                         uuid.c \
109                         sipe-win32dep.c
111 PURPLE_C_SRC =          ../purple/purple-buddy.c \
112                         ../purple/purple-chat.c \
113                         ../purple/purple-connection.c \
114                         ../purple/purple-debug.c \
115                         ../purple/purple-dnsquery.c \
116                         ../purple/purple-ft.c \
117                         ../purple/purple-groupchat.c \
118                         ../purple/purple-im.c \
119                         ../purple/purple-markup.c \
120                         ../purple/purple-mime.c \
121                         ../purple/purple-network.c \
122                         ../purple/purple-notify.c \
123                         ../purple/purple-plugin.c \
124                         ../purple/purple-schedule.c \
125                         ../purple/purple-search.c \
126                         ../purple/purple-setting.c \
127                         ../purple/purple-status.c \
128                         ../purple/purple-transport.c \
129                         ../purple/purple-user.c
131 C_TEST_SRC =            sipe-xml-tests.c
133 ifdef USE_SSPI
134 CLEAN_C_SRC +=          sip-sec-sspi.c
135 else
136 CLEAN_C_SRC +=          md4.c \
137                         sip-sec-ntlm.c \
138                         sip-sec-tls-dsk.c
140 C_TEST_SRC +=           sip-sec-ntlm-tests.c \
141                         ../purple/tests.c
142 endif
144 C_SRC =                 $(CLEAN_C_SRC) $(PURPLE_C_SRC)
146 CLEAN_OBJECTS =         $(CLEAN_C_SRC:%.c=%.o)
147 PURPLE_OBJECTS =        $(PURPLE_C_SRC:%.c=%.o)
148 OBJECTS =               $(CLEAN_OBJECTS) $(PURPLE_OBJECTS)
150 # Only these modules need the purple headers
151 $(PURPLE_OBJECTS):      INCLUDE_PATHS += $(PURPLE_INCLUDE_PATHS)
153 TEST_OBJECTS =          $(C_TEST_SRC:%.c=%.o)
156 ## LIBRARIES
158 LIB_PATHS =             -L$(GTK_TOP)/lib \
159                         -L$(LIBXML2_TOP)/lib \
160                         -L$(NSS_TOP)/lib \
161                         -L$(PURPLE_TOP)
163 LIBS =                  -lglib-2.0 \
164                         -lgobject-2.0 \
165                         -lintl \
166                         -lxml2 \
167                         -lnss3 \
168                         -lsmime3 \
169                         -lnspr4 \
170                         -lws2_32 \
171                         -lpurple
173 ifdef USE_SSPI
174 LIBS +=                 -lsecur32
175 endif
177 # These flags are used in mingw build
178 TESTS_WARN = -Werror -Wall -Wextra -Waggregate-return -Wcast-align -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
180 include $(PIDGIN_COMMON_RULES)
183 ## TARGET DEFINITIONS
185 .PHONY: all clean install
187 all: $(TARGET).dll
189 $(OBJECTS): $(PURPLE_CONFIG_H)
191 $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS)
192         $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll
195 ## CLEAN RULES
197 clean: tests-clean
198         rm -f $(OBJECTS)
199         rm -f $(TARGET).dll
201 rmbak:
202         rm -f *~
204 install:
205         test -z "$(DLL_INSTALL_DIR)" || mkdir -p "$(DLL_INSTALL_DIR)"
206         /usr/bin/install -c $(TARGET).dll '$(DLL_INSTALL_DIR)'
208 $(TEST_OBJECTS):
210 tests: tests-clean $(TEST_OBJECTS)
211         $(CC) sipe-utils.o uuid.o sipe-xml.o sipe-xml-tests.o -L. $(LIB_PATHS) $(LIBS) -lsipe -o sipe-xml-tests.exe
212         ./sipe-xml-tests.exe
213 ifdef USE_SSPI
214 # nothing to do
215 else
216         $(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
217         ../purple/tests.exe
218 endif
220 tests-clean:
221         rm -f $(TEST_OBJECTS)
222         rm -f sipe-xml-tests.exe ../purple/tests.exe
224 include $(PIDGIN_COMMON_TARGETS)