!ifndef BOOSTDIR
BOOSTDIR = ../../boost_1_34_1
!endif

COMMON_CXXFLAGS = -nologo -EHac -GR -I. -I../include

!ifdef CXXLATEST
STD_CXXFLAGS = -std:c++latest -permissive-
!endif

!ifdef WARNINGS
WARNINGS_CXXFLAGS = -W4 -wd4512 -wd4447
!endif

!ifdef STATICRTL
! ifdef DEBUG
DEBUG_CXXFLAGS = -Zi -MTd
! else
DEBUG_CXXFLAGS = -O2 -MT
! endif
!else
! ifdef DEBUG
DEBUG_CXXFLAGS = -Zi -MDd
! else
DEBUG_CXXFLAGS = -O2 -MD
! endif
!endif

!ifdef UNICODE
UNICODE_CXXFLAGS = -DUNICODE -D_UNICODE
!endif

!ifdef TRACKING
TRACKING_CXXFLAGS = -DASIO_ENABLE_HANDLER_TRACKING
!endif

!ifndef _WIN32_WINNT
! ifdef STORE
_WIN32_WINNT=0x0603
! else
_WIN32_WINNT=0x0601
! endif
!endif

!ifdef WIN9X
DEFINES = \
	-DASIO_DISABLE_IOCP \
	-D_WIN32_WINNT=$(_WIN32_WINNT) \
	-DBOOST_ALL_NO_LIB \
	-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
!else
! ifdef STORE
DEFINES = \
	-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP \
	-DBOOST_ALL_NO_LIB -D_WIN32_WINNT=$(_WIN32_WINNT) \
	-DUNICODE -D_UNICODE \
	-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
! else
!  ifdef WINRT
DEFINES = \
	-ZW -FI SDKDDKVer.h -FI winapifamily.h -DWINAPI_FAMILY=WINAPI_PARTITION_APP \
	-DBOOST_ALL_NO_LIB \
	-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
!  else
DEFINES = \
	-D_WIN32_WINNT=$(_WIN32_WINNT) \
	-DBOOST_ALL_NO_LIB \
	-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
!  endif
! endif
!endif

!ifdef SEPARATE_COMPILATION
LIBS = asio.lib
SEPARATE_COMPILATION_CXXFLAGS = \
	-DASIO_SEPARATE_COMPILATION \
	-DASIO_ENABLE_CANCELIO
!endif

!ifdef STANDALONE
STANDALONE_CXXFLAGS = -DASIO_STANDALONE
!else
STANDALONE_CXXFLAGS = -I$(BOOSTDIR) -DASIO_ENABLE_BOOST
!endif

CXXFLAGS = \
	$(COMMON_CXXFLAGS) \
	$(STD_CXXFLAGS) \
	$(WARNINGS_CXXFLAGS) \
	$(DEBUG_CXXFLAGS) \
	$(UNICODE_CXXFLAGS) \
	$(TRACKING_CXXFLAGS) \
	$(SEPARATE_COMPILATION_CXXFLAGS) \
	$(STANDALONE_CXXFLAGS)

!ifndef SSLDIR
SSLDIR = ../../openssl-0.9.8g
!endif

SSL_CXXFLAGS = -I$(SSLDIR)/inc32

SSL_LIBS = \
	$(SSLDIR)/out32/libeay32.lib \
	$(SSLDIR)/out32/ssleay32.lib \
	user32.lib advapi32.lib gdi32.lib

LATENCY_TEST_EXES = \
	tests\latency\tcp_client.exe \
	tests\latency\tcp_server.exe \
	tests\latency\udp_client.exe \
	tests\latency\udp_server.exe

PERFORMANCE_TEST_EXES = \
	tests\performance\client.exe \
	tests\performance\server.exe

UNIT_TEST_EXES = \
	tests\unit\any_completion_executor.exe \
	tests\unit\any_completion_handler.exe \
	tests\unit\any_io_executor.exe \
	tests\unit\append.exe \
	tests\unit\as_tuple.exe \
	tests\unit\associated_allocator.exe \
	tests\unit\associated_cancellation_slot.exe \
	tests\unit\associated_executor.exe \
	tests\unit\associator.exe \
	tests\unit\async_result.exe \
	tests\unit\awaitable.exe \
	tests\unit\basic_datagram_socket.exe \
	tests\unit\basic_deadline_timer.exe \
	tests\unit\basic_file.exe \
	tests\unit\basic_random_access_file.exe \
	tests\unit\basic_raw_socket.exe \
	tests\unit\basic_readable_pipe.exe \
	tests\unit\basic_seq_packet_socket.exe \
	tests\unit\basic_serial_port.exe \
	tests\unit\basic_signal_set.exe \
	tests\unit\basic_socket.exe \
	tests\unit\basic_socket_acceptor.exe \
	tests\unit\basic_stream_file.exe \
	tests\unit\basic_stream_socket.exe \
	tests\unit\basic_streambuf.exe \
	tests\unit\basic_waitable_timer.exe \
	tests\unit\basic_writable_pipe.exe \
	tests\unit\bind_allocator.exe \
	tests\unit\bind_cancellation_slot.exe \
	tests\unit\bind_executor.exe \
	tests\unit\bind_immediate_executor.exe \
	tests\unit\buffered_read_stream.exe \
	tests\unit\buffered_stream.exe \
	tests\unit\buffered_write_stream.exe \
	tests\unit\buffer.exe \
	tests\unit\buffer_registration.exe \
	tests\unit\buffers_iterator.exe \
	tests\unit\cancel_after.exe \
	tests\unit\cancel_at.exe \
	tests\unit\cancellation_signal.exe \
	tests\unit\cancellation_state.exe \
	tests\unit\cancellation_type.exe \
	tests\unit\co_spawn.exe \
	tests\unit\completion_condition.exe \
	tests\unit\compose.exe \
	tests\unit\composed.exe \
	tests\unit\config.exe \
	tests\unit\connect.exe \
	tests\unit\connect_pipe.exe \
	tests\unit\coroutine.exe \
	tests\unit\deadline_timer.exe \
	tests\unit\defer.exe \
	tests\unit\deferred.exe \
	tests\unit\detached.exe \
	tests\unit\dispatch.exe \
	tests\unit\disposition.exe \
	tests\unit\error.exe \
	tests\unit\execution_context.exe \
	tests\unit\execution\any_executor.exe \
	tests\unit\execution\blocking.exe \
	tests\unit\execution\blocking_adaptation.exe \
	tests\unit\execution\context_as.exe \
	tests\unit\execution\executor.exe \
	tests\unit\execution\inline_exception_handling.exe \
	tests\unit\execution\invocable_archetype.exe \
	tests\unit\execution\mapping.exe \
	tests\unit\execution\outstanding_work.exe \
	tests\unit\execution\prefer_only.exe \
	tests\unit\execution\relationship.exe \
	tests\unit\executor.exe \
	tests\unit\executor_work_guard.exe \
	tests\unit\file_base.exe \
	tests\unit\generic\basic_endpoint.exe \
	tests\unit\generic\datagram_protocol.exe \
	tests\unit\generic\raw_protocol.exe \
	tests\unit\generic\seq_packet_protocol.exe \
	tests\unit\generic\stream_protocol.exe \
	tests\unit\high_resolution_timer.exe \
	tests\unit\immediate.exe \
	tests\unit\inline_executor.exe \
	tests\unit\inline_or_executor.exe \
	tests\unit\io_context.exe \
	tests\unit\io_context_strand.exe \
	tests\unit\ip\address.exe \
	tests\unit\ip\address_v4.exe \
	tests\unit\ip\address_v4_iterator.exe \
	tests\unit\ip\address_v4_range.exe \
	tests\unit\ip\address_v6.exe \
	tests\unit\ip\address_v6_iterator.exe \
	tests\unit\ip\address_v6_range.exe \
	tests\unit\ip\basic_endpoint.exe \
	tests\unit\ip\basic_resolver.exe \
	tests\unit\ip\basic_resolver_entry.exe \
	tests\unit\ip\basic_resolver_iterator.exe \
	tests\unit\ip\basic_resolver_query.exe \
	tests\unit\ip\host_name.exe \
	tests\unit\ip\icmp.exe \
	tests\unit\ip\multicast.exe \
	tests\unit\ip\network_v4.exe \
	tests\unit\ip\network_v6.exe \
	tests\unit\ip\resolver_query_base.exe \
	tests\unit\ip\tcp.exe \
	tests\unit\ip\udp.exe \
	tests\unit\ip\unicast.exe \
	tests\unit\ip\v6_only.exe \
	tests\unit\local\basic_endpoint.exe \
	tests\unit\local\connect_pair.exe \
	tests\unit\local\datagram_protocol.exe \
	tests\unit\local\stream_protocol.exe \
	tests\unit\is_read_buffered.exe \
	tests\unit\is_write_buffered.exe \
	tests\unit\packaged_task.exe \
	tests\unit\placeholders.exe \
	tests\unit\post.exe \
	tests\unit\prepend.exe \
	tests\unit\random_access_file.exe \
	tests\unit\read.exe \
	tests\unit\read_at.exe \
	tests\unit\read_until.exe \
	tests\unit\readable_pipe.exe \
	tests\unit\recycling_allocator.exe \
	tests\unit\redirect_error.exe \
	tests\unit\registered_buffer.exe \
	tests\unit\serial_port.exe \
	tests\unit\serial_port_base.exe \
	tests\unit\signal_set.exe \
	tests\unit\signal_set_base.exe \
	tests\unit\socket_base.exe \
	tests\unit\static_thread_pool.exe \
	tests\unit\steady_timer.exe \
	tests\unit\strand.exe \
	tests\unit\stream_file.exe \
	tests\unit\streambuf.exe \
	tests\unit\system_context.exe \
	tests\unit\system_executor.exe \
	tests\unit\system_timer.exe \
	tests\unit\this_coro.exe \
	tests\unit\thread.exe \
	tests\unit\thread_pool.exe \
	tests\unit\time_traits.exe \
	tests\unit\ts\buffer.exe \
	tests\unit\ts\executor.exe \
	tests\unit\ts\internet.exe \
	tests\unit\ts\io_context.exe \
	tests\unit\ts\net.exe \
	tests\unit\ts\netfwd.exe \
	tests\unit\ts\socket.exe \
	tests\unit\ts\timer.exe \
	tests\unit\use_awaitable.exe \
	tests\unit\use_future.exe \
	tests\unit\uses_executor.exe \
	tests\unit\wait_traits.exe \
	tests\unit\windows\basic_object_handle.exe \
	tests\unit\windows\basic_overlapped_handle.exe \
	tests\unit\windows\basic_random_access_handle.exe \
	tests\unit\windows\basic_stream_handle.exe \
	tests\unit\windows\object_handle.exe \
	tests\unit\windows\overlapped_handle.exe \
	tests\unit\windows\overlapped_ptr.exe \
	tests\unit\windows\random_access_handle.exe \
	tests\unit\windows\stream_handle.exe \
	tests\unit\writable_pipe.exe \
	tests\unit\write.exe \
	tests\unit\write_at.exe

CPP11_EXAMPLE_EXES = \
	examples\cpp11\allocation\server.exe \
	examples\cpp11\buffers\reference_counted.exe \
	examples\cpp11\chat\chat_client.exe \
	examples\cpp11\chat\chat_server.exe \
	examples\cpp11\echo\async_tcp_echo_server.exe \
	examples\cpp11\echo\async_udp_echo_server.exe \
	examples\cpp11\echo\blocking_tcp_echo_client.exe \
	examples\cpp11\echo\blocking_tcp_echo_server.exe \
	examples\cpp11\echo\blocking_udp_echo_client.exe \
	examples\cpp11\echo\blocking_udp_echo_server.exe \
	examples\cpp11\http\client\async_client.exe \
	examples\cpp11\http\client\sync_client.exe \
	examples\cpp11\http\server\http_server.exe \
	examples\cpp11\http\server2\http_server.exe \
	examples\cpp11\http\server3\http_server.exe \
	examples\cpp11\http\server4\http_server.exe \
	examples\cpp11\icmp\ping.exe \
	examples\cpp11\invocation\prioritised_handlers.exe \
	examples\cpp11\iostreams\daytime_client.exe \
	examples\cpp11\iostreams\daytime_server.exe \
	examples\cpp11\iostreams\http_client.exe \
	examples\cpp11\multicast\receiver.exe \
	examples\cpp11\multicast\sender.exe \
	examples\cpp11\nonblocking\third_party_lib.exe \
	examples\cpp11\porthopper\client.exe \
	examples\cpp11\porthopper\server.exe \
	examples\cpp11\services\daytime_client.exe \
	examples\cpp11\socks4\sync_client.exe \
	examples\cpp11\timeouts\async_tcp_client.exe \
	examples\cpp11\timeouts\blocking_tcp_client.exe \
	examples\cpp11\timeouts\blocking_token_tcp_client.exe \
	examples\cpp11\timeouts\blocking_udp_client.exe \
	examples\cpp11\timeouts\server.exe \
	examples\cpp11\timers\time_t_timer.exe \
	examples\cpp11\tutorial\timer1\timer.exe \
	examples\cpp11\tutorial\timer2\timer.exe \
	examples\cpp11\tutorial\timer3\timer.exe \
	examples\cpp11\tutorial\timer4\timer.exe \
	examples\cpp11\tutorial\timer5\timer.exe \
	examples\cpp11\tutorial\daytime1\client.exe \
	examples\cpp11\tutorial\daytime2\server.exe \
	examples\cpp11\tutorial\daytime3\server.exe \
	examples\cpp11\tutorial\daytime4\client.exe \
	examples\cpp11\tutorial\daytime5\server.exe \
	examples\cpp11\tutorial\daytime6\server.exe \
	examples\cpp11\tutorial\daytime7\server.exe \
	examples\cpp11\windows\transmit_file.exe

SSL_UNIT_TEST_EXES = \
	tests\unit\ssl\basic_context.exe \
	tests\unit\ssl\context.exe \
	tests\unit\ssl\context_base.exe \
	tests\unit\ssl\context_service.exe \
	tests\unit\ssl\stream.exe \
	tests\unit\ssl\stream_base.exe \
	tests\unit\ssl\stream_service.exe

SSL_EXAMPLE_EXES = \
	examples\cpp11\ssl\client.exe \
	examples\cpp11\ssl\server.exe

!ifdef SEPARATE_COMPILATION
all: asio.lib
asio.lib: asio.cpp
	cl -Fe$@ -Foasio.obj $(CXXFLAGS) $(DEFINES) -c asio.cpp
	lib -name:asio.lib asio.obj
!endif

!ifdef STANDALONE
all: \
	$(CPP11_EXAMPLE_EXES) \
	$(UNIT_TEST_EXES)
!else
all: \
	$(LATENCY_TEST_EXES) \
	$(PERFORMANCE_TEST_EXES) \
	$(CPP11_EXAMPLE_EXES) \
	$(UNIT_TEST_EXES)
!endif

ssl: \
	$(SSL_UNIT_TEST_EXES) \
	$(SSL_EXAMPLE_EXES)

check: $(UNIT_TEST_EXES)
	!@echo === Running $** === && $** && echo.

{tests\latency}.cpp{tests\latency}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\performance}.cpp{tests\performance}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

tests\unit\unit_test.obj: tests\unit\unit_test.cpp
	cl -Fe$@ -Fotests\unit\unit_test.obj $(CXXFLAGS) $(DEFINES) -c tests\unit\unit_test.cpp

{tests\unit}.cpp{tests\unit}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\unit\execution}.cpp{tests\unit\execution}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\unit\generic}.cpp{tests\unit\generic}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\unit\ip}.cpp{tests\unit\ip}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\unit\local}.cpp{tests\unit\local}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\unit\ssl}.cpp{tests\unit\ssl}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(SSL_CXXFLAGS) $(DEFINES) $< $(SSL_LIBS) $(LIBS) -link -opt:ref

{tests\unit\ts}.cpp{tests\unit\ts}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{tests\unit\windows}.cpp{tests\unit\windows}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\allocation}.cpp{examples\cpp11\allocation}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\buffers}.cpp{examples\cpp11\buffers}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\chat}.cpp{examples\cpp11\chat}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\echo}.cpp{examples\cpp11\echo}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\http\client}.cpp{examples\cpp11\http\client}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\icmp}.cpp{examples\cpp11\icmp}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\invocation}.cpp{examples\cpp11\invocation}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\iostreams}.cpp{examples\cpp11\iostreams}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\multicast}.cpp{examples\cpp11\multicast}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\nonblocking}.cpp{examples\cpp11\nonblocking}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\porthopper}.cpp{examples\cpp11\porthopper}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\socks4}.cpp{examples\cpp11\socks4}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\ssl}.cpp{examples\cpp11\ssl}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(SSL_CXXFLAGS) $(DEFINES) $< $(SSL_LIBS) $(LIBS) -link -opt:ref

{examples\cpp11\timeouts}.cpp{examples\cpp11\timeouts}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\timers}.cpp{examples\cpp11\timers}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\timer1}.cpp{examples\cpp11\tutorial\timer1}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\timer2}.cpp{examples\cpp11\tutorial\timer2}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\timer3}.cpp{examples\cpp11\tutorial\timer3}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\timer4}.cpp{examples\cpp11\tutorial\timer4}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\timer5}.cpp{examples\cpp11\tutorial\timer5}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime1}.cpp{examples\cpp11\tutorial\daytime1}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime2}.cpp{examples\cpp11\tutorial\daytime2}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime3}.cpp{examples\cpp11\tutorial\daytime3}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime4}.cpp{examples\cpp11\tutorial\daytime4}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime5}.cpp{examples\cpp11\tutorial\daytime5}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime6}.cpp{examples\cpp11\tutorial\daytime6}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\tutorial\daytime7}.cpp{examples\cpp11\tutorial\daytime7}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\windows}.cpp{examples\cpp11\windows}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\executors}.cpp{examples\cpp11\executors}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp11\operations}.cpp{examples\cpp11\operations}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

{examples\cpp14\operations}.cpp{examples\cpp14\operations}.exe:
	cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref

examples\cpp11\http\server\http_server.exe: \
		examples\cpp11\http\server\connection.cpp \
		examples\cpp11\http\server\connection_manager.cpp \
		examples\cpp11\http\server\main.cpp \
		examples\cpp11\http\server\mime_types.cpp \
		examples\cpp11\http\server\reply.cpp \
		examples\cpp11\http\server\request_handler.cpp \
		examples\cpp11\http\server\request_parser.cpp \
		examples\cpp11\http\server\server.cpp
	cl -Fe$@ -Foexamples\cpp11\http\server\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref

examples\cpp11\http\server2\http_server.exe: \
		examples\cpp11\http\server2\connection.cpp \
		examples\cpp11\http\server2\io_context_pool.cpp \
		examples\cpp11\http\server2\main.cpp \
		examples\cpp11\http\server2\mime_types.cpp \
		examples\cpp11\http\server2\reply.cpp \
		examples\cpp11\http\server2\request_handler.cpp \
		examples\cpp11\http\server2\request_parser.cpp \
		examples\cpp11\http\server2\server.cpp
	cl -Fe$@ -Foexamples\cpp11\http\server2\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref

examples\cpp11\http\server3\http_server.exe: \
		examples\cpp11\http\server3\connection.cpp \
		examples\cpp11\http\server3\main.cpp \
		examples\cpp11\http\server3\mime_types.cpp \
		examples\cpp11\http\server3\reply.cpp \
		examples\cpp11\http\server3\request_handler.cpp \
		examples\cpp11\http\server3\request_parser.cpp \
		examples\cpp11\http\server3\server.cpp
	cl -Fe$@ -Foexamples\cpp11\http\server3\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref

examples\cpp11\http\server4\http_server.exe: \
		examples\cpp11\http\server4\file_handler.cpp \
		examples\cpp11\http\server4\main.cpp \
		examples\cpp11\http\server4\mime_types.cpp \
		examples\cpp11\http\server4\reply.cpp \
		examples\cpp11\http\server4\request_parser.cpp \
		examples\cpp11\http\server4\server.cpp
	cl -Fe$@ -Foexamples\cpp11\http\server4\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref

examples\cpp11\services\daytime_client.exe: \
		examples\cpp11\services\daytime_client.cpp \
		examples\cpp11\services\logger_service.cpp
	cl -Fe$@ -Foexamples\cpp11\services\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref

clean:
	-del /q /s asio.lib
	-del /q /s asio.obj
	-del /q /s tests\*.exe
	-del /q /s tests\*.exe.manifest
	-del /q /s tests\*.exp
	-del /q /s tests\*.ilk
	-del /q /s tests\*.pdb
	-del /q /s tests\*.obj
	-del /q /s examples\*.exe
	-del /q /s examples\*.exe.manifest
	-del /q /s examples\*.exp
	-del /q /s examples\*.ilk
	-del /q /s examples\*.pdb
	-del /q /s examples\*.obj
	-del /q /s *.pdb
