# Common settings for Borland 32-bit compilation (makefile.b32 files)

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

BORLAND_SUFFIX=bc
DEBUG_SUFFIX=

MAKEFLAGS=FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) OUTPUTDIR=$(OUTPUTDIR) EXEDIR=$(EXEDIR)

WXDIR = $(WXWIN)
CFG = wxw32

!ifndef OUTPUTDIR
OBJ_PATH=$(WXDIR)\BORL
OUTPUTDIR=$(WXDIR)\BORL
!else
OBJ_PATH=$(OUTPUTDIR)
!endif

!ifndef BCCDIR
BCCDIR=$(MAKEDIR)\..
!endif

!if "$(BCCDIR)" == "\.."
!error Your Borland compiler does not define MAKEDIR. Pleasedefine the BCCDIR variable in makeb32.env line 10, e.g. BCCDIR=d:\bc4
!endif

ARCHINCDIR=$(WXDIR)\lib\$(BORLAND_SUFFIX)
ARCHSETUPH=$(ARCHINCDIR)\wx\setup.h
#see below for SETUPSRCDIR

!ifndef WXLIBDIR
WXLIBDIR = $(WXDIR)\lib
!endif

WXINC = $(WXDIR)\include;$(WXDIR)\contrib\include;$(WXDIR)\src\iodbc;$(WXDIR)\src\regex;
WIN95FLAG = -D__WIN95__ -D__WINDOWS__
RFLAGS = -i$(WXDIR)\include;$(WXDIR)\src

# This should be changed to tlink32 if ilink32 is not available.
# Ilink32 is available on BC++ 5.02 and above, and all
# versions of C++ Builder.
!ifndef LINK
LINK=ilink32
#LINK=tlink32
!endif

!ifndef FINAL
FINAL=0
!endif

!ifndef WXMAKINGDLL
WXMAKINGDLL=0
!endif

!if "$(FINAL)" == "1"
OPT = -O2
DEBUG_FLAGS = -DUSE_DEFINE
LINKDEBUGFLAGS=
!else
OPT = -Od
DEBUG_FLAGS= -v -DWXDEBUG=1 -D__WXDEBUG__ -DUSE_DEFINE
LINKDEBUGFLAGS=/v
!endif

# allow to use debugger but no wxDebugging functions
!if "$(FINAL)" == "hybrid"
OPT = -Od
DEBUG_FLAGS= -v 
LINKDEBUGFLAGS=/v
!endif

!ifndef DLL
DLL=0
!else
DLL=1
WXMAKINGDLL=1
!endif

# Target             WXMAKINGDLL       WXUSINGDLL     WXBUILDDLL
# wxWin DLL              1                 0               1
# wxWin STATIC           0                 0               0
# App use wxWin DLL      0                 1               0
# DLL use wxWin DLL      0                 1               1
# DLL use wxWin STATIC   0                 0               1
#

# Determine the library name depending on the options, to allow
# multiple versions to coexist.
# Note that the clean target will only delete the appropriate .lib for the current
# options and all the obj files, and note that you must delete the obj files if you
# change the options so that they are compiled using the correct ones.

WXLIBNAME=wx25


## Use this if you want to use the UNIV controls set rather than the native ones 
## make -f makefile.b32 WXUSINGUNIV=1
!if "$(WXUSINGUNIV)" == "1"
USE_UNIV="UNIV"
BORLAND_SUFFIX=$(BORLAND_SUFFIX)v
ARCHINCDIR=$(ARCHINCDIR)v
SETUPSRCDIR=$(WXDIR)\include\wx\univ
PORT=__WXUNIVERSAL__
!else
USE_UNIV=""
PORT=__WXMSW__
SETUPSRCDIR=$(WXDIR)\include\wx\msw
!endif

#unicode builds handled inside setup.h

#a hybrid , does not set __WXDEBUG__ but sets -v (see above)
!if "$(FINAL)" == "hybrid"
DEBUG_SUFFIX=$(DEBUG_SUFFIX)h
!endif

!if "$(FINAL)" == "0"
DEBUG_SUFFIX=$(DEBUG_SUFFIX)d
!endif

!if "$(wxUSE_GUI)" == "0"
BORLAND_SUFFIX=$(BORLAND_SUFFIX)b
CPPFLAGS=-DwxUSE_GUI=0
!endif

!if "$(WXMAKINGDLL)" != "1" && "$(WXUSINGDLL)" != "1"
BORLAND_SUFFIX=$(BORLAND_SUFFIX)s
!endif

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

# final names determined here
WXLIB=$(WXLIBDIR)\$(WXLIBNAME)_$(BORLAND_SUFFIX)$(DEBUG_SUFFIX).lib
WXDLL=$(WXLIBDIR)\$(WXLIBNAME)_$(BORLAND_SUFFIX)$(DEBUG_SUFFIX).dll
LIBTARGET=$(WXLIBDIR)\$(LIBTARGET)_bc$(DEBUG_SUFFIX).lib
OBJ_PATH=$(OBJ_PATH)_$(BORLAND_SUFFIX)$(DEBUG_SUFFIX)

!if "$(WXMAKINGDLL)" == "1"
DLL_FLAGS= -DWXMAKINGDLL=1 -D_RTLDLL
!else

!if "$(WXUSINGDLL)" == "1"
DLL_FLAGS= -DWXUSINGDLL=1 -D_RTLDLL
!else
DLL_FLAGS=
!endif

!endif

!if "$(WXBUILDDLL)" == "1"
LINK_FLAGS= /Tpd /c $(EXTRALINKFLAGS)
!endif

CFG=$(OBJ_PATH)\$(CFG).cfg
CPPFLAGS=$(CPPFLAGS) $(DLL_FLAGS) @$(CFG) $(EXTRACPPFLAGS)

DUMMY=dummy

SRCSUFF = cpp
OBJSUFF = obj

WAITFLAG = /w

.$(SRCSUFF).obj:
    bcc32 $(CPPFLAGS) -c -n$(OBJ_PATH) {$< }

.c.obj:
    bcc32 $(CPPFLAGS) -P- -c -n$(OBJ_PATH) {$< }
