diff --git a/Makefile.nmake b/Makefile.nmake index f0ec1023..39efbc91 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,10 +1,26 @@ -# WATCH OUT! This makefile is a work in progress. +# WATCH OUT! This makefile is a work in progress. -*- makefile -*- # # I'm not very knowledgeable about MSVC and nmake beyond their most basic # aspects. If anything here looks wrong to you, please let me know. +# If OPENSSL_DIR is not set, builds without OpenSSL support. If you want +# OpenSSL support, you can set the OPENSSL_DIR variable to where you +# installed OpenSSL. This can be done in the environment: +# set OPENSSL_DIR=c:\openssl +# Or on the nmake command line: +# nmake OPENSSL_DIR=C:\openssl -f Makefile.nmake +# Or by uncommenting the following line here in the makefile... + +# OPENSSL_DIR=c:\openssl + +!IFDEF OPENSSL_DIR +SSL_CFLAGS=/I$(OPENSSL_DIR)\include /DEVENT__HAVE_OPENSSL +!ELSE +SSL_CFLAGS= +!ENDIF + # Needed for correctness -CFLAGS=/IWIN32-Code /Iinclude /Icompat /DHAVE_CONFIG_H /I. +CFLAGS=/IWIN32-Code /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS) # For optimization and warnings CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo @@ -21,8 +37,16 @@ WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \ event_iocp.obj bufferevent_async.obj EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj -ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) -STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib +!IFDEF OPENSSL_DIR +SSL_OBJS=bufferevent_openssl.obj +SSL_LIBS=libevent_openssl.lib +!ELSE +SSL_OBJS= +SSL_LIBS= +!ENDIF + +ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) $(SSL_OBJS) +STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib $(SSL_LIBS) all: static_libs tests @@ -38,12 +62,21 @@ libevent_extras.lib: $(EXTRA_OBJS) libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib +libevent_openssl.lib: $(SSL_OBJS) + lib $(LIBFLAGS) $(SSL_OBJS) /out:libevent_openssl.lib + clean: del $(ALL_OBJS) del $(STATIC_LIBS) cd test $(MAKE) /F Makefile.nmake clean + cd .. tests: cd test +!IFDEF OPENSSL_DIR + $(MAKE) OPENSSL_DIR=$(OPENSSL_DIR) /F Makefile.nmake +!ELSE $(MAKE) /F Makefile.nmake +!ENDIF + cd .. diff --git a/test/Makefile.nmake b/test/Makefile.nmake index 6f37db9b..f33ca530 100644 --- a/test/Makefile.nmake +++ b/test/Makefile.nmake @@ -1,5 +1,16 @@ +# WATCH OUT! This makefile is a work in progress. -*- makefile -*- -CFLAGS=/I.. /I../WIN32-Code /I../include /I../compat /DHAVE_CONFIG_H /DTINYTEST_LOCAL +!IFDEF OPENSSL_DIR +SSL_CFLAGS=/I$(OPENSSL_DIR)\include /DEVENT__HAVE_OPENSSL +SSL_OBJS=regress_ssl.obj +SSL_LIBS=..\libevent_openssl.lib $(OPENSSL_DIR)\lib\libeay32.lib $(OPENSSL_DIR)\lib\ssleay32.lib +!ELSE +SSL_CFLAGS= +SSL_OBJS= +SSL_LIBS= +!ENDIF + +CFLAGS=/I.. /I../WIN32-Code /I../include /I../compat /DHAVE_CONFIG_H /DTINYTEST_LOCAL $(SSL_CFLAGS) CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo @@ -9,7 +20,7 @@ REGRESS_OBJS=regress.obj regress_buffer.obj regress_http.obj regress_dns.obj \ regress_et.obj regress_bufferevent.obj \ regress_listener.obj regress_util.obj tinytest.obj \ regress_main.obj regress_minheap.obj regress_iocp.obj \ - regress_thread.obj + regress_thread.obj $(SSL_OBJS) OTHER_OBJS=test-init.obj test-eof.obj test-weof.obj test-time.obj \ bench.obj bench_cascade.obj bench_http.obj bench_httpclient.obj \ @@ -28,7 +39,7 @@ LIBS=..\libevent.lib ws2_32.lib shell32.lib advapi32.lib all: $(PROGRAMS) regress.exe: $(REGRESS_OBJS) - $(CC) $(CFLAGS) $(LIBS) $(REGRESS_OBJS) + $(CC) $(CFLAGS) $(LIBS) $(SSL_LIBS) $(REGRESS_OBJS) test-init.exe: test-init.obj $(CC) $(CFLAGS) $(LIBS) test-init.obj