# --------------------- INFORMATION --------------------------------

# This the test Makefile for Windows and the Microsoft Visual C++
# compiler.  It assumes a Unix-like setup for some commands.

# The dtest program itself does not use multi-threading, 
# but the library might, depending on how it was compiled.

# The Makefile also allows an "un-official" and ugly, but
# sometimes practical compilation of a directly integrated
# executable (i.e. not using the DLL).  For this the Makefile
# uses the source and object files in the src directory...
# Use "make itest" at your own risk.

# If you need to add something for the threading system, this is
# the place.

BOOST32_PATH1   = \User\sheins\boost_1_66_0_x32_new
BOOST32_LIB1    = $(BOOST32_PATH1)\lib32-msvc-14.1

BOOST32_PATH2   = \Users\s.hein\Documents\Programs\boost_1_66_0_x32_14_1
BOOST32_LIB2    = $(BOOST32_PATH2)\lib32-msvc-14.1

CC_BOOST_INCL	= /I$(BOOST32_PATH1) /I$(BOOST32_PATH2)
CC_BOOST_LINK	= /LIBPATH:$(BOOST32_LIB1) /LIBPATH:$(BOOST32_LIB2)

THREAD_LINK	= $(CC_BOOST_LINK)

# ----------------------- OFTEN OK    ------------------------------

# From here on you you don't have to change anything to CONFIGURE
# the compilation.  But you may well have to change something to 
# get it to compile.

INCL_DDS_SOURCE	= Makefiles/dds_sources.txt
INCL_OWN_SOURCE	= Makefiles/own_sources.txt
INCL_DEPENDS	= Makefiles/depends_obj.txt

# If your compiler name is not given here, change it.
CC		= cl

# We compile with aggressive warnings, but we have to turn off some
# of them as they appear in libraries in great numbers...

WARN_FLAGS	=		\
	/Wall			\
	/wd4127			\
	/wd4242			\
	/wd4244			\
	/wd4365			\
	/wd4464			\
	/wd4514			\
	/wd4530			\
	/wd4555			\
	/wd4577			\
	/wd4592			\
	/wd4625			\
	/wd4626			\
	/wd4668			\
	/wd4701			\
	/wd4710			\
	/wd4711			\
	/wd4774			\
	/wd4820			\
	/wd4986			\
	/wd4987			\
	/wd4996			\
	/wd5026			\
	/wd5027			\
	/WX

COMPILE_FLAGS  	= /O2 /Oi /Ot /Oy /GL $(WARN_FLAGS)

DLLBASE		= dds
DLL 		= $(DLLBASE).dll
DLIB 		= $(DLLBASE).lib
EXPORTER	= Exports.def

LINK1_FLAGS	= /LTCG
LINK2_FLAGS	= $(THREAD_LINK)

# This is in addition to $(DTEST).cpp

include $(INCL_OWN_SOURCE)

DTEST_OBJ_FILES	= $(subst .cpp,.obj,$(DTEST_SOURCE_FILES)) $(DTEST).obj

DTEST		= dtest
ITEST		= itest

# These are the files that we steal from the src directory.

include $(INCL_DDS_SOURCE)

ITEST_SOURCE_FILES	=	\
	$(DDS_SOURCE_FILES)	\
	$(DTEST_SOURCE_FILES)	\
	itest.cpp

ITEST_OBJ_FILES	= $(subst .cpp,.obj,$(ITEST_SOURCE_FILES))

dtest:	$(DTEST_OBJ_FILES)
	link $(LINK1_FLAGS) $(DTEST_OBJ_FILES) $(DLIB) \
	$(LINK2_FLAGS) /out:$(DTEST).exe

itest:	$(ITEST_OBJ_FILES)
	link $(LINK1_FLAGS) $(ITEST_OBJ_FILES) \
	$(LINK2_FLAGS) /out:$(ITEST).exe

%.obj:	%.cpp
	$(CC) $(COMPILE_FLAGS) $(CC_BOOST_INCL) /c $< /Fo$*.obj

depend:
	makedepend -Y -o.obj -- $(ITEST_SOURCE_FILES) $(DTEST).cpp

clean:
	rm -f $(ITEST_OBJ_FILES) $(DTEST).{obj,exe} \
	$(ITEST).{exe,exp,lib} $(DLL) $(DLIB)

# If you don't have a Linux-like setup, use "del" instead of "rm".

include $(INCL_DEPENDS)
