
default:
	nmake -f makefile.win final CFG=$(CFG) _64bit=$(_64bit)

.phony: release
release:
	nmake -f makefile.win final CFG=release

.phony: debug
debug:
	nmake -f makefile.win final CFG=debug

.phony: release_shared
release_shared:
	nmake -f makefile.win final CFG=release SHARED=1

.phony: debug_shared
debug_shared:
	nmake -f makefile.win final CFG=debug SHARED=1

release64:
	nmake -f makefile.win final CFG=release _64bit=_64bit

debug64:
	nmake -f makefile.win final CFG=debug _64bit=_64bit

.cpp.obj:
	$(CC) $(CFLAGS) $(SPECCFLAGS) -c $<

{.}.cpp{$(OUT)}.obj:
	$(CC) $(CFLAGS) $(SPECCFLAGS) -Fo$(OUT)\ -c $<

#	@echo start %time% $<
#	@echo end %time% $<

#!IF !DEFINED(AUREL)
#AUREL = 1
#!ENDIF

!IF !DEFINED(WXVER)
WXVER = 30
!ENDIF

!IF "$(SHARED)"=="1"
!IF "$(_64bit)"==""
WX_BLD_PREF=vc_dll
!ELSE
WX_BLD_PREF=vc_x64_dll
!ENDIF
!ELSE
!IF "$(_64bit)"==""
WX_BLD_PREF=vc_lib
LIB_BLD_PREF=Win32
!ELSE
WX_BLD_PREF=vc_x64_lib
LIB_BLD_PREF=x64
!ENDIF
!ENDIF

!IF "$(BASEDIR)"==""
COREDIR=./
!ELSE
COREDIR=$(BASEDIR)/core
!ENDIF

!IF "$(CFG)"=="debug"
#DEBUG
CFLAGS = -I"$(WXWIN)\include" -I"$(WXWIN)\lib\$(WX_BLD_PREF)\mswud" -I"$(GLUT)$(_64bit)\include" -I"$(GLEW)\include" -D__WINDOWS__ -D_CRT_SECURE_NO_WARNINGS -D_UNICODE -DUNICODE /EHsc /W3 /nologo /c /TP /errorReport:prompt /RTC1 /Od /MDd /Z7  -D__WXDEBUG__ -DGLUT_BUILDING_LIB -DGLEW_STATIC /D_CRT_SECURE_NO_DEPRECATE -I"$(COREDIR)" /DVRUT_CORE_STATIC
# -IC:\data\Tonda\freeglut-2.6.0\include /DFREEGLUT_STATIC -DSYNC_DEBUG -DSYNC_DEBUG_NET -DVRUT_HPC
LFLAGS = /DEBUG /LIBPATH:"$(GLUT)$(_64bit)" /LIBPATH:"$(GLEW)\lib\Debug\$(LIB_BLD_PREF)" /LIBPATH:"$(WXWIN)\lib\$(WX_BLD_PREF)" wxpngd.lib wxzlibd.lib wxjpegd.lib wxtiffd.lib wxmsw$(WXVER)ud_core.lib \
	wxbase$(WXVER)ud.lib wxmsw$(WXVER)ud_gl.lib wxmsw$(WXVER)ud_aui.lib wxbase$(WXVER)ud_net.lib wxmsw$(WXVER)ud_adv.lib wxbase$(WXVER)ud_xml.lib wxexpatd.lib wxmsw$(WXVER)ud_html.lib wxmsw$(WXVER)ud_webview.lib\
	wxmsw$(WXVER)ud_ribbon.lib wxmsw$(WXVER)ud_xrc.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib rpcrt4.lib \
	winmm.lib wsock32.lib winspool.lib uuid.lib odbc32.lib odbccp32.lib glut32.lib glew32sd.lib
#  C:\data\Tonda\freeglut-2.6.0\DebugStatic\freeglut_static.lib
DLLNAME = $(MODULE)_d.dll

!ELSE

#RELEASE
CFLAGS = -I"$(WXWIN)\include" -I"$(WXWIN)\lib\$(WX_BLD_PREF)\mswu" -I"$(GLUT)$(_64bit)\include" -I"$(GLEW)\include" -D__WINDOWS__ -D_CRT_SECURE_NO_WARNINGS -D_UNICODE -DUNICODE -DGLEW_STATIC /EHsc /W3 /O2 /nologo /c /TP /errorReport:prompt /MD -DGLUT_BUILDING_LIB /D_CRT_SECURE_NO_DEPRECATE=1 -I"$(COREDIR)" /DNDEBUG /DVRUT_CORE_STATIC
# /Z7 -D_SECURE_SCL=0 /DSYNC_DEBUG /DSYNC_DEBUG_NET
LFLAGS = /LIBPATH:"$(GLUT)$(_64bit)" /LIBPATH:"$(GLEW)\lib\Release\$(LIB_BLD_PREF)" /LIBPATH:"$(WXWIN)\lib\$(WX_BLD_PREF)" wxpng.lib wxzlib.lib wxjpeg.lib wxtiff.lib wxmsw$(WXVER)u_core.lib \
	wxbase$(WXVER)u.lib wxmsw$(WXVER)u_gl.lib wxmsw$(WXVER)u_aui.lib wxbase$(WXVER)u_net.lib wxmsw$(WXVER)u_adv.lib wxbase$(WXVER)u_xml.lib wxexpat.lib wxmsw$(WXVER)u_html.lib wxmsw$(WXVER)u_webview.lib \
	wxmsw$(WXVER)u_ribbon.lib wxmsw$(WXVER)u_xrc.lib user32.lib ole32.lib gdi32.lib shell32.lib comctl32.lib advapi32.lib comdlg32.lib Rpcrt4.lib \
	winmm.lib wsock32.lib kernel32.lib winspool.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glut32.lib glew32s.lib
# /DEBUG -force
DLLNAME = $(MODULE).dll

!IF "$(SHARED)" == "1"
LFLAGS = $(LFLAGS) opengl32.lib glu32.lib 
!ENDIF


!ENDIF

!IF "$(_64bit)"!=""
CFLAGS = $(CFLAGS) -D__WIN64__
!ELSE
LFLAGS = $(LFLAGS) /LARGEADDRESSAWARE
!ENDIF



!IF "$(AUREL)"=="1"
CFLAGS = $(CFLAGS) -I"$(OPENCV)$(_64bit)\build\include" -DAUREL


!IF "$(CFG)"=="debug"
LFLAGS = $(LFLAGS) /LIBPATH:"$(OPENCV)$(_64bit)\lib\Debug" opencv_core231.lib opencv_highgui231.lib
!ELSE
LFLAGS = $(LFLAGS) /LIBPATH:"$(OPENCV)$(_64bit)\lib\Release" opencv_core231.lib opencv_highgui231.lib
!ENDIF
!ENDIF

#-DwxUSE_GUI=1;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;__WXDEBUG__;WXDEBUG=1;_CRT_SECURE_NO_WARNINGS;
