xref: /freebsd/contrib/libevent/Makefile.nmake (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1# 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
21
22# Needed for correctness
23CFLAGS=/IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H /I. $(SSL_CFLAGS)
24
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 \
35	bufferevent_ratelim.obj evutil_rand.obj evutil_time.obj
36WIN_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
40!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)
50
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
65libevent_openssl.lib: $(SSL_OBJS)
66	lib $(LIBFLAGS) $(SSL_OBJS) /out:libevent_openssl.lib
67
68clean:
69	del $(ALL_OBJS)
70	del $(STATIC_LIBS)
71	cd test
72	$(MAKE) /F Makefile.nmake clean
73	cd ..
74
75tests:
76	cd test
77!IFDEF OPENSSL_DIR
78	$(MAKE) OPENSSL_DIR=$(OPENSSL_DIR) /F Makefile.nmake
79!ELSE
80	$(MAKE) /F Makefile.nmake
81!ENDIF
82	cd ..
83