#
# File:		makevc.env
# Author:	Ulrich Leodolter
# Created:	Wed May 17 08:36:42 1995
# Updated:
#
#	MSVC++ 32-bit makefile include file
#
!include <ntwin32.mak>

# read version numbers
!include "version.mak"
WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE)

!if "$(RM)" == ""
RM= erase
!endif

# WIN95 means "all systems newer than Win95", i.e. Win9x and NT 4+
WIN95=1

!if "$(WIN95)" == "0"
# With 3.50, Win95 will use your existing icons to show smaller ones.
# With 4.0, you'll have to follow Win95 procedures for icons or you'll get the
# default Windows icon.
APPVER=3.50
WINVERSION=-DWINVER=0x0350 # Generic WIN32
!else
APPVER=4.0
# This means 'enable Windows 95 features' (in wxWindows and in VC++ 4.0).
WINVERSION=-DWINVER=0x0400
!endif

# On Alpha machines, change to CPU=ALPHA
CPU=i386

# Suffixes
OBJSUFF=obj
SRCSUFF=cpp

WAITFLAG=/w

# If you set wxUSE_IOSTREAMH to 0, remove 
# -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally
#WINFLAGS=-c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION) -DSTRICT
WINFLAGS=-c -W3 -nologo -DWIN32 -D_WINDOWS $(WINVERSION) -DSTRICT
WINLINKFLAGS=-nologo -machine:$(CPU) -subsystem:windows,$(APPVER)
BASELINKFLAGS=-nologo -machine:$(CPU) -subsystem:console,$(APPVER)
WINLIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib \
 shell32.lib oldnames.lib comctl32.lib odbc32.lib ole32.lib oleaut32.lib \
 uuid.lib rpcrt4.lib advapi32.lib wsock32.lib \
 # libci.lib # libci.lib required for VC++ 4.2

# Set a WXWIN environment variable be the path to your WXWIN directory
WXDIR=$(WXWIN)

WXSRC=$(WXDIR)\src\msw
WXINC=$(WXDIR)\include
WXBASESRC=$(WXDIR)\src\common

#####################################################################
# These are the possible DLL/non-DLL usages:
#
# Type             	_DLL/_WINDLL WXUSINGDLL  WXMAKINGDLL  Library
#--------------------------------------------------------------------
# Normal application    -            -           -            wx.lib
#
# wxWin as DLL          Defined      -           Defined      wx$(WXVERSION).lib
#
# App using wxWin DLL   -            Defined     -            wx$(WXVERSION).lib
#
# App built as one DLL  Defined      -           -            wx.lib
#
######################################################################
#
# Compiling your app:
#--------------------
# when compiling an app to use the DLL version of wxWindows
# (but not to be a DLL itself), set WXUSINGDLL to 1 in your
# makefile just before including ntwxwin.mak.
# To compile wxWin _and_ app itself as a DLL, set DLL to 1
# in ntwxwin.mak, and do not set WXUSINGDLL.
#
# Compiling wxWindows:
#---------------------
# Use the dll target to compile wxWindows as DLL; then make 'pch'
# to generate a precompiled header for your apps to use. BUG: must compile without
# wxExpr (USE_WX_RESOURCES = 0) for this to link properly. Don't know why yet.
# Use the dllapp target to compile wxWindows for making a DLL app (not implemented yet)

#DLL=0

!if "$(WXUSINGDLL)" == "1"
EXTRADLLFLAGS=/DWXUSINGDLL=1
!endif

!if "$(WXMAKINGDLL)" == "1"
EXTRADLLFLAGS=/DWXMAKINGDLL=1
!endif

!if "$(WXMAKINGDLL)" == "0" && "$(DLL)" == "1"
EXTRADLLFLAGS=
!endif

!if "$(NOMAIN)" == "1"
EXTRADLLFLAGS=$(EXTRADLLFLAGS) /DNOMAIN
!endif

!ifndef UNICODE
UNICODE=0
!endif

!ifndef MSLU
MSLU=0
!endif

!ifndef FINAL
FINAL=0
!endif

!ifndef DEBUGINFO
!if "$(FINAL)" == "0"
DEBUGINFO=1
!else
DEBUGINFO=0
!endif
!endif

!ifndef DLL
DLL=0
!endif

# Set this to 1 if you don't want to use precompiled headers
!ifndef NOPCH
NOPCH=0
!endif

# This sets 'D' to a suitable directory name: [Base](Debug|Release|Hybrid)[Dll]
# for this kind of build, and WXLIBNAME to one of wx(msw|base)[u][d] (static),
# wx(msw|base)$(WXVERSION)[u][d] (DLL)

!if "$(UNICODE)" == "1"
_WXLIB_SUFFIX=u
_WXINC_SUFFIX=u
_WXDIR_UNICODESUFFIX=Unicode
!endif

!if "$(WXMAKINGDLL)" == "1" || "$(WXUSINGDLL)" == "1"
_WXLIB_VERSION=$(WXVERSION)
_WXDIR_DLLSUFFIX=Dll
_WXINC_DLLSUFFIX=dll
!else
_WXLIB_VERSION=
_WXDIR_DLLSUFFIX=
_WXINC_DLLSUFFIX=
!endif

!if "$(FINAL)" == "1"
_WXDIR_BUILD=Release
LIBEXT=
# no _WXDIR_SUFFIX
!else if "$(FINAL)" == "hybrid"
_WXDIR_BUILD=Hybrid
LIBEXT=h
!else
guilibsdll= oldnames.lib kernel32.lib \
  ws2_32.lib mswsock.lib advapi32.lib user32.lib \
  gdi32.lib comdlg32.lib winspool.lib
_WXDIR_BUILD=Debug
LIBEXT=d
!endif

!if "$(wxUSE_GUI)" == "0"
_WXDIR_PREFIX=Base
_WXLIB_NAME=wxbase
_WXINC_BUILD=base
!else
_WXDIR_PREFIX=
_WXLIB_NAME=wxmsw
_WXINC_BUILD=msw
!endif

!if "$(UNICODE)" == "1"
UNIFLAGS=-DUNICODE -D_UNICODE -DwxUSE_UNICODE=1
!endif

!if "$(wxUSE_GUI)" == "0"
UNIFLAGS=$(UNIFLAGS) -DwxUSE_GUI=0
!endif

!if "$(WXMAKINGDLL)" == "1" || "$(WXUSINGDLL)" == "1"
D=$(D)DLL
INCEXT=dll$(INCEXT)
!endif

D=$(_WXDIR_PREFIX)$(_WXDIR_BUILD)$(_WXDIR_UNICODESUFFIX)$(_WXDIR_DLLSUFFIX)
WXLIBNAME=$(_WXLIB_NAME)$(_WXLIB_VERSION)$(_WXLIB_SUFFIX)$(LIBEXT)
INCEXT=$(_WXINC_SUFFIX)$(LIBEXT)

!if "$(NEW_WXLIBNAME)" != ""
WXLIBNAME=$(NEW_WXLIBNAME)
!endif

#----------------------------------------------------------------------
# MSLU == Microsoft Layer for Unicode
# See MSDN or the Platform SDK docs for details
!if "$(MSLU)" == "1"
MSLU_FLAGS=/nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib
MSLU_LIBS=$(MSLU_FLAGS) unicows.lib
!endif

WXLIB=$(WXDIR)\lib\$(WXLIBNAME).lib

INC=$(EXTRAINC) -I$(WXDIR)/lib/$(_WXINC_BUILD)$(_WXINC_DLLSUFFIX)$(_WXINC_SUFFIX)$(LIBEXT) -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/regex -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/tiff

!if "$(WXUSINGDLL)" == "1" || "$(wxUSE_GUI)" == "0"
LIBS = $(MSLU_LIBS) $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\regex$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib
!else
LIBS = $(MSLU_LIBS) $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\regex$(LIBEXT).lib $(WXDIR)\lib\png$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib $(WXDIR)\lib\jpeg$(LIBEXT).lib $(WXDIR)\lib\tiff$(LIBEXT).lib
!endif

OPTIONS=

!if "$(DEBUGINFO)" == "0"

!if "$(FINAL)" == "hybrid"
OPT = /Ox /Gy
!else
# /O1 - smallest code
# /O2 - fastest code
OPT = /O1 # /O2 # /Od
!endif

LINK_DEBUG_FLAGS=/RELEASE

!else
OPT = /Od /Gy /Zi
LINK_DEBUG_FLAGS=-debug:full -debugtype:cv
!endif

!if "$(FINAL)" == "0"
# ***N.B.*** to save space/time, comment out /FR to avoid browse info (.sbr files) being generated
DEBUG_FLAGS= /D__WXDEBUG__ # /DDEBUG=1 # /FR
_CRTFLAG=/MDd

!else if "$(FINAL)" == "hybrid"
DEBUG_FLAGS= /D__WXDEBUG__ /D__NO_VC_CRTDBG__
_CRTFLAG=/MD

!else
DEBUG_FLAGS=
_CRTFLAG=/MD

!endif


!if "$(CRTFLAG)" == ""
CRTFLAG=$(_CRTFLAG)
!endif

!if "$(NOPCH)" == "1"

PCH=
PRECOMP=
MAKEPRECOMP=

!else

!if "$(wxUSE_GUI)" == "0"
PCH=wxBase.pch
!else
PCH=wxWindows.pch
!endif

PRECOMP=/YuWX/WXPREC.H /Fp$(WXDIR)\$D\$(PCH) /Fd$(WXDIR)\lib\$(WXLIBNAME).pdb
MAKEPRECOMP=/YcWX/WXPREC.H

!endif

!if "$(DLL)" == "0"

CPPFLAGS=$(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) $(INC) $(OPT) $(EXTRADLLFLAGS)  $(CRTFLAG) $(OVERRIDEFLAGS)
# If you don't include wxprec.h, use CPPFLAGS2
CPPFLAGS2=$(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(INC) $(EXTRAFLAGS) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) $(OVERRIDEFLAGS)

!if "$(wxUSE_GUI)" == "0"
LINKFLAGS=$(LINK_DEBUG_FLAGS) $(BASELINKFLAGS)
!else
LINKFLAGS=$(LINK_DEBUG_FLAGS) $(WINLINKFLAGS)
!endif

DUMMY=dummy

!else

CPPFLAGS= $(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) $(INC) $(OPT) /D_DLL $(CRTFLAG) $(EXTRADLLFLAGS) /D_WINDLL
CPPFLAGS2=$(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(EXTRAFLAGS) $(INC) $(OPT) /D_DLL $(CRTFLAG) $(EXTRADLLFLAGS) /D_WINDLL

!if "$(wxUSE_GUI)" == "0"
LINKFLAGS=$(LINK_DEBUG_FLAGS) $(BASELINKFLAGS) -dll
!else
LINKFLAGS=$(LINK_DEBUG_FLAGS) $(WINLINKFLAGS) -dll
!endif

!if "$(WXMAKINGDLL)" == "1"
DUMMY=dummydll
!else
DUMMY=dummy
!endif

!endif

DUMMYOBJ=$(WXDIR)\$D\$(DUMMY).obj

.c.obj:
	cl @<<
$(CPPFLAGS2) /Fo$@ /c $<
<<

.cpp.obj:
	cl @<<
$(CPPFLAGS2) /Fo$@ /c $<
<<

#use CPPFLAGS2 so as not to use precompiled headers
{}.c{$D}.obj:
	cl @<<
$(CPPFLAGS2) /Fo$@ /c $<
<<

{}.cpp{$D}.obj:
	cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $<
<<

