# 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. # If you are using the prebuild script, set the OpenSSL # lib path in the prebuild script, not here. OPENSSL = ../../openssl/openssl-0.9.8e/ LZO = ../../lzo/lzo-2.02/ DMALLOC = /c/src/dmalloc-5.4.2 ######################################################### CC = /usr/bin/i586-mingw32msvc-gcc CFLAGS = -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin INCLUDE_DIRS = -I$(LZO)/include/lzo -I$(OPENSSL)/include LIBS = -llzo2 -lcrypt32 -lws2_32 -lgdi32 -liphlpapi -lwinmm LIB_DIRS = -L$(LZO) -L$(OPENSSL)/out # # DMalloc related stuff CC_DMALLOC = $(CC) $(CFLAGS) -fno-inline -DDMALLOC INCLUDE_DIRS_DMALLOC = $(INCLUDE_DIRS) -I$(DMALLOC) LIBS_DMALLOC = $(LIBS) -ldmalloc LIB_DIRS_DMALLOC = $(LIB_DIRS) -L$(DMALLOC) # The executable which should be build EXE = openvpn.exe # # The object files which are needed tfor building $(EXE) 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 \ lzo.o \ manage.o \ mbuf.o \ misc.o \ mroute.o \ mss.o \ mtcp.o \ mtu.o \ mudp.o \ multi.o \ ntlm.o \ occ.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 # # Build static linked executable (no aditial openssl library needed) static: $(OBJS) @echo Building statically linked executable $(CC) $(CFLAGS) -o $(EXE) $(OBJS) $(LIB_DIRS) -lssl -lcrypto $(LIBS) # # Build dynamic linked executable dynamic: $(OBJS) @echo Building dynamically linked executable $(CC) $(CFLAGS) -o $(EXE) $(OBJS) $(LIB_DIRS) $(LIBS) -lssl -leay32 # # ... dmalloc: $(OBJS) $(EXE) $(CC) $(CFLAGS) -o $(EXE) $(OBJS) $(LIB_DIRS_DMALLOC) -leay32 $(LIBS_DMALLOC) # # Tidy up clean : rm -f $(OBJS) $(EXE) # # How to compile .c files into .object files .c.o: $(CC) $(CFLAGS) $(INCLUDE_DIRS) -c $< -o $@