1275970Scy# WATCH OUT!  This makefile is a work in progress.             -*- makefile -*-
2275970Scy#
3275970Scy# I'm not very knowledgeable about MSVC and nmake beyond their most basic
4275970Scy# aspects.  If anything here looks wrong to you, please let me know.
5275970Scy
6275970Scy# If OPENSSL_DIR is not set, builds without OpenSSL support.  If you want
7275970Scy# OpenSSL support, you can set the OPENSSL_DIR variable to where you
8275970Scy# installed OpenSSL.  This can be done in the environment:
9275970Scy#   set OPENSSL_DIR=c:\openssl
10275970Scy# Or on the nmake command line:
11275970Scy#   nmake OPENSSL_DIR=C:\openssl -f Makefile.nmake
12275970Scy# Or by uncommenting the following line here in the makefile...
13275970Scy
14275970Scy# OPENSSL_DIR=c:\openssl
15275970Scy
16275970Scy!IFDEF OPENSSL_DIR
17275970ScySSL_CFLAGS=/I$(OPENSSL_DIR)\include /DEVENT__HAVE_OPENSSL
18275970Scy!ELSE
19275970ScySSL_CFLAGS=
20275970Scy!ENDIF
21275970Scy
22275970Scy# Needed for correctness
23275970ScyCFLAGS=/IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS)
24275970Scy
25275970Scy# For optimization and warnings
26275970ScyCFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo
27275970Scy
28275970Scy# XXXX have a debug mode
29275970Scy
30275970ScyLIBFLAGS=/nologo
31275970Scy
32275970ScyCORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \
33275970Scy	bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \
34275970Scy	strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \
35275970Scy	bufferevent_ratelim.obj evutil_rand.obj evutil_time.obj
36275970ScyWIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \
37275970Scy	event_iocp.obj bufferevent_async.obj
38275970ScyEXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj
39275970Scy
40275970Scy!IFDEF OPENSSL_DIR
41275970ScySSL_OBJS=bufferevent_openssl.obj
42275970ScySSL_LIBS=libevent_openssl.lib
43275970Scy!ELSE
44275970ScySSL_OBJS=
45275970ScySSL_LIBS=
46275970Scy!ENDIF
47275970Scy
48275970ScyALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) $(SSL_OBJS)
49275970ScySTATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib $(SSL_LIBS)
50275970Scy
51275970Scy
52275970Scyall: static_libs tests
53275970Scy
54275970Scystatic_libs: $(STATIC_LIBS)
55275970Scy
56275970Scylibevent_core.lib: $(CORE_OBJS) $(WIN_OBJS)
57275970Scy	lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib 
58275970Scy
59275970Scylibevent_extras.lib: $(EXTRA_OBJS)
60275970Scy	lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib
61275970Scy
62275970Scylibevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
63275970Scy	lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib
64275970Scy
65275970Scylibevent_openssl.lib: $(SSL_OBJS)
66275970Scy	lib $(LIBFLAGS) $(SSL_OBJS) /out:libevent_openssl.lib
67275970Scy
68275970Scyclean:
69275970Scy	del $(ALL_OBJS)
70275970Scy	del $(STATIC_LIBS)
71275970Scy	cd test
72275970Scy	$(MAKE) /F Makefile.nmake clean
73275970Scy	cd ..
74275970Scy
75275970Scytests:
76275970Scy	cd test
77275970Scy!IFDEF OPENSSL_DIR
78275970Scy	$(MAKE) OPENSSL_DIR=$(OPENSSL_DIR) /F Makefile.nmake
79275970Scy!ELSE
80275970Scy	$(MAKE) /F Makefile.nmake
81275970Scy!ENDIF
82275970Scy	cd ..
83