commit d5b06d5ffca94df97127728e68ef717b22e1cdfc Author: Maximilian Wilhelm Date: Tue Jul 31 19:39:15 2007 +0200 Cleaned up makefile.w32 and make use of make's advantages. Signed-off-by: Maximilian Wilhelm diff --git a/makefile.w32 b/makefile.w32 index c70d256..06e07dd 100755 --- a/makefile.w32 +++ b/makefile.w32 @@ -37,95 +37,39 @@ # If you are using the prebuild script, set the OpenSSL # lib path in the prebuild script, not here. -OPENSSL = /c/src/openssl-0.9.7k -LZO = /c/src/lzo-1.08 +OPENSSL = ../../openssl/openssl-0.9.8e/ +LZO = ../../lzo/lzo-2.02/ DMALLOC = /c/src/dmalloc-5.4.2 ######################################################### -CC = gcc -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin +CC = /usr/bin/i586-mingw32msvc-gcc -CC_DMALLOC = gcc -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin -fno-inline -DDMALLOC +CFLAGS = -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin -INCLUDE_DIRS = -I${OPENSSL}/include -I${LZO}/include -INCLUDE_DIRS_DMALLOC = ${INCLUDE_DIRS} -I${DMALLOC} +INCLUDE_DIRS = -I$(LZO)/include/lzo -I$(OPENSSL)/include -LIBS = -llzo -lcrypt32 -lws2_32 -lgdi32 -liphlpapi -lwinmm +LIBS = -llzo2 -lcrypt32 -lws2_32 -lgdi32 -liphlpapi -lwinmm -LIBS_DMALLOC = ${LIBS} -ldmalloc +LIB_DIRS = -L$(LZO) -L$(OPENSSL)/out -LIB_DIRS = -L${OPENSSL}/out -L${LZO} +# +# DMalloc related stuff +CC_DMALLOC = $(CC) $(CFLAGS) -fno-inline -DDMALLOC -LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC} +INCLUDE_DIRS_DMALLOC = $(INCLUDE_DIRS) -I$(DMALLOC) + +LIBS_DMALLOC = $(LIBS) -ldmalloc + +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 \ - 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 \ - 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 +# 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 \ @@ -177,23 +121,34 @@ OBJS = base64.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} +# +# 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) -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} +# +# Tidy up clean : - rm -f ${OBJS} ${EXE} + rm -f $(OBJS) $(EXE) -%.o : %.c ${HEADERS} - ${MY_CC} ${MY_INCLUDE_DIRS} -c $< -o $@ + +# +# How to compile .c files into .object files +.c.o: + $(CC) $(CFLAGS) $(INCLUDE_DIRS) -c $< -o $@