summaryrefslogtreecommitdiffstats
path: root/makefile.w32
blob: bb9af54d8c0d3347405c17c4586fc73e305ba85c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# This Makefile builds the user-mode component
# of OpenVPN for WIN32 in the MinGW environment.
#
# Build Dependencies:
#	mingw		(GNU C compiler for windows)
#	msys		(GNU utilities and shell for windows)
#	OpenSSL		(SSL/TLS/crypto library)
#	LZO		(real-time compression library)
#       Dmalloc         (debugging only)
#
# Targets:
#	static -- link statically with OpenSSL
#       dynamic -- link dynamically with OpenSSL
#       dmalloc -- enable memory debugging using the dmalloc library 
#
# Note that LZO is always linked statically.
#
# To build openssl-0.9.7d, remember to edit ms\mw.bat
# adding '--win32' flag to make command:
#
#   make --win32 -f ms/mingw32.mak
#
# Now cd to top level openssl directory in a Windows
# command-prompt window, and type:
#
#   ms\mw
#
# See additional .bat scripts in install-win32 for OpenSSL
# build setup.
#
# If you are building with dmalloc debugging support
# see windbg.h for additional dmalloc notes.

#########################################################
# Change these to point to your OpenSSL, LZO, and
# (optionally) dmalloc top-level directories.

OPENSSL = /c/src/openssl-0.9.7i
LZO = /c/src/lzo-2.02
DMALLOC = /c/src/dmalloc-5.4.2

#########################################################

CC = gcc -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin

CC_DMALLOC = gcc -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin -fno-inline -DDMALLOC

INCLUDE_DIRS = -I${OPENSSL}/include -I${LZO}/include

INCLUDE_DIRS_DMALLOC = ${INCLUDE_DIRS} -I${DMALLOC}

LIBS = -llzo2 -lcrypt32 -lWinInet -lws2_32 -lgdi32 -liphlpapi -lwinmm

LIBS_DMALLOC = ${LIBS} -ldmalloc

LIB_DIRS = -L${OPENSSL}/out -L${LZO}

LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC}

EXE = openvpn.exe

HEADERS = \
	base64.h \
	basic.h \
	buffer.h \
	circ_list.h \
	common.h \
	tap-win32/common.h \
        config-win32.h \
	crypto.h \
	cryptoapi.h \
	errlevel.h \
	error.h \
	event.h \
        fdmisc.h \
	forward-inline.h \
	forward.h \
	fragment.h \
        gremlin.h \
	helper.h \
	init.h \
	integer.h \
	interval.h \
	list.h \
	lladdr.h \
	lzo.h \
	manage.h \
	mbuf.h \
	memdbg.h \
	misc.h \
	mroute.h \
	mss.h \
	mtcp.h \
	mtu.h \
	mudp.h \
	multi.h \
	ntlm.h \
	occ-inline.h \
	occ.h \
	pkcs11.h pkcs11-helper.h cryptoki.h \
        openvpn.h \
	openvpn-plugin.h \
	options.h \
	otime.h \
	packet_id.h \
	perf.h \
	ping-inline.h \
	ping.h \
	plugin.h \
	pool.h \
        proto.h \
	proxy.h \
	push.h \
	reliable.h \
	route.h \
	schedule.h \
	session_id.h \
        shaper.h \
	sig.h \
	socket.h \
	socks.h \
	ssl.h \
        status.h \
	syshead.h \
        thread.h \
	tun.h \
	win32.h

OBJS =  base64.o \
	buffer.o \
	crypto.o \
	cryptoapi.o \
	error.o \
	event.o \
	fdmisc.o \
	forward.o \
        fragment.o \
	gremlin.o \
	helper.o \
	init.o \
	interval.o \
        list.o \
	lladdr.o \
	lzo.o \
	manage.o \
	mbuf.o \
	misc.o \
	mroute.o \
	mss.o \
	mtcp.o \
	mtu.o \
	mudp.o \
	multi.o \
	ntlm.o \
	occ.o \
	pkcs11.o pkcs11-helper.o \
        openvpn.o \
	options.o \
	otime.o \
	packet_id.o \
	perf.o \
	ping.o \
	plugin.o \
        pool.o \
	proto.o \
	proxy.o \
	push.o \
	reliable.o \
        route.o \
	schedule.o \
	session_id.o \
	shaper.o \
	sig.o \
	socket.o \
        socks.o \
	ssl.o \
	status.o \
	thread.o \
	tun.o \
	win32.o

dynamic : MY_CC = ${CC}
dynamic : MY_INCLUDE_DIRS = ${INCLUDE_DIRS}
dynamic : ${OBJS}
	${MY_CC} -o ${EXE} ${OBJS} ${LIB_DIRS} -lssl32 -leay32 ${LIBS}

static : MY_CC = ${CC}
static : MY_INCLUDE_DIRS = ${INCLUDE_DIRS}
static : ${OBJS}
	${CC} -o ${EXE} ${OBJS} ${LIB_DIRS} -lssl -lcrypto ${LIBS}

dmalloc : MY_CC = ${CC_DMALLOC}
dmalloc : MY_INCLUDE_DIRS = ${INCLUDE_DIRS_DMALLOC}
dmalloc : ${OBJS}
	${MY_CC} -o ${EXE} ${OBJS} ${LIB_DIRS_DMALLOC} -lssl32 -leay32 ${LIBS_DMALLOC}

clean :
	rm -f ${OBJS} ${EXE}

%.o : %.c ${HEADERS}
	${MY_CC} ${MY_INCLUDE_DIRS} -c $< -o $@