blob: f27cd61949a23385b5047f95c7c6bcf28ff2adc6 [file] [log] [blame]
Narayan Kamathfc74cb42017-09-13 12:53:52 +01001# WATCH OUT! This makefile is a work in progress. -*- makefile -*-
2#
3# I'm not very knowledgeable about MSVC and nmake beyond their most basic
4# aspects. If anything here looks wrong to you, please let me know.
5
6# If OPENSSL_DIR is not set, builds without OpenSSL support. If you want
7# OpenSSL support, you can set the OPENSSL_DIR variable to where you
8# installed OpenSSL. This can be done in the environment:
9# set OPENSSL_DIR=c:\openssl
10# Or on the nmake command line:
11# nmake OPENSSL_DIR=C:\openssl -f Makefile.nmake
12# Or by uncommenting the following line here in the makefile...
13
14# OPENSSL_DIR=c:\openssl
15
16!IFDEF OPENSSL_DIR
17SSL_CFLAGS=/I$(OPENSSL_DIR)\include /DEVENT__HAVE_OPENSSL
18!ELSE
19SSL_CFLAGS=
20!ENDIF
Christopher Wileye8679812015-07-01 13:36:18 -070021
22# Needed for correctness
Narayan Kamathfc74cb42017-09-13 12:53:52 +010023CFLAGS=/IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS)
Christopher Wileye8679812015-07-01 13:36:18 -070024
25# For optimization and warnings
26CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo
27
28# XXXX have a debug mode
29
30LIBFLAGS=/nologo
31
32CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \
33 bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \
34 strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \
Narayan Kamathfc74cb42017-09-13 12:53:52 +010035 bufferevent_ratelim.obj evutil_rand.obj evutil_time.obj
Christopher Wileye8679812015-07-01 13:36:18 -070036WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \
37 event_iocp.obj bufferevent_async.obj
38EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj
39
Narayan Kamathfc74cb42017-09-13 12:53:52 +010040!IFDEF OPENSSL_DIR
41SSL_OBJS=bufferevent_openssl.obj
42SSL_LIBS=libevent_openssl.lib
43!ELSE
44SSL_OBJS=
45SSL_LIBS=
46!ENDIF
47
48ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) $(SSL_OBJS)
49STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib $(SSL_LIBS)
Christopher Wileye8679812015-07-01 13:36:18 -070050
51
52all: static_libs tests
53
54static_libs: $(STATIC_LIBS)
55
56libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS)
57 lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib
58
59libevent_extras.lib: $(EXTRA_OBJS)
60 lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib
61
62libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
63 lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib
64
Narayan Kamathfc74cb42017-09-13 12:53:52 +010065libevent_openssl.lib: $(SSL_OBJS)
66 lib $(LIBFLAGS) $(SSL_OBJS) /out:libevent_openssl.lib
67
Christopher Wileye8679812015-07-01 13:36:18 -070068clean:
69 del $(ALL_OBJS)
70 del $(STATIC_LIBS)
71 cd test
72 $(MAKE) /F Makefile.nmake clean
Narayan Kamathfc74cb42017-09-13 12:53:52 +010073 cd ..
Christopher Wileye8679812015-07-01 13:36:18 -070074
75tests:
76 cd test
Narayan Kamathfc74cb42017-09-13 12:53:52 +010077!IFDEF OPENSSL_DIR
78 $(MAKE) OPENSSL_DIR=$(OPENSSL_DIR) /F Makefile.nmake
79!ELSE
Christopher Wileye8679812015-07-01 13:36:18 -070080 $(MAKE) /F Makefile.nmake
Narayan Kamathfc74cb42017-09-13 12:53:52 +010081!ENDIF
82 cd ..