#
# Defines specific to a particular version of the compiler
#
# Inputs:
# ~~~~~~~
# STATIC - if defined means creating a static library or executable
# PASCAL - if defined means link dll against pascal run-time library
# DEBUG - if defined means building with debug information
#
# Outputs:
# ~~~~~~~~
# CC - name of compiler
# LD - name of linker
# AR - name of librarian
# RC - name of resource compiler
# COMMON_CFLAGS - compiler flags for all targets
# COMMON_LFLAGS - linker flags for all targets
# COMMON_LIBS - linker library files for all targets
# DLL_CFLAGS - compiler flags specific to DLL targets
# DLL_LFLAGS - linker flags specific to DLL targets
# DLL_STARTUP_OBJ - start-up object files for DLL targets
# EXE_CFLAGS - compiler flags specific to EXE targets
# EXE_LFLAGS - linker flags specific to EXE targets
# EXE_STARTUP_OBJ - start-up object files for EXE targets
# LIB_CFLAGS - compiler flags specific to static lib targets
# LIB_LFLAGS - flags specific to static lib targets (passed to
#              librarian)
#


!include <$(ACE_ROOT)\include\makeinclude\ace_flags.bor>

#
# Build tools
#

CC = bcc32
LD = ilink32
AR = tlib
RC = brcc32

#
# Common flags
#

!ifdef DEBUG
DEBUG_CFLAGS = -v -y -Od -r- -vi- -k -D_DEBUG
DEBUG_LFLAGS = -v
!else
DEBUG_CFLAGS = -O2 -DNDEBUG
DEBUG_LFLAGS =
!endif

!ifdef STATIC
STATIC_CFLAGS =
STATIC_LFLAGS =
!else
STATIC_CFLAGS = -tWR
STATIC_LFLAGS =
!endif

!ifdef CODEGUARD
CODEGUARD_CFLAGS = -vG
!endif

THREAD_CFLAGS = -D_MT -tWM
WARNINGS_CFLAGS = -w-rvl -w-rch -w-ccc -w-obs -w-aus -w-pia -w-inl
DEFINES_CFLAGS = -DWIN32;_NO_VCL
QUIET_CFLAGS = -q
MISC_CFLAGS = -a8 -b

COMMON_CFLAGS = $(QUIET_CFLAGS) $(DEBUG_CFLAGS) $(THREAD_CFLAGS) \
	$(STATIC_CFLAGS) $(WARNINGS_CFLAGS) $(DEFINES_CFLAGS) \
	$(MISC_CFLAGS) $(CODEGUARD_CFLAGS)

COMMON_LFLAGS = $(DEBUG_LFLAGS) $(STATIC_LFLAGS) -x -w-dup -Gn

#
# DLL specific flags
#

DLL_CFLAGS = -tWD
DLL_LFLAGS = -Tpd -Gi
!ifdef PASCAL
DLL_STARTUP_OBJ = c0d32.obj sysinit.obj
!else
DLL_STARTUP_OBJ = c0d32.obj
!endif

#
# EXE specific flags
#

EXE_CFLAGS =
EXE_LFLAGS = -Tpe
!ifdef PASCAL
EXE_STARTUP_OBJ = c0x32.obj sysinit.obj
!else
EXE_STARTUP_OBJ = c0x32.obj
!endif

#
# Static lib specific flags
#

LIB_CFLAGS =
!ifdef DEBUG
LIB_LFLAGS = /C /P4096
!else
LIB_LFLAGS = /C /P512
!endif

#
# VCL lib version number
#

!if $(BCBVER) == 5
VCLVER = 50
!else
VCLVER = 40
!endif

#
# Libraries to be linked
#

!ifdef CODEGUARD
CODEGUARD_LIB = cg32.lib
!endif

!ifdef STATIC
!ifdef PASCAL
COMMON_LIBS = $(CODEGUARD_LIB) import32.lib vcl$(VCLVER).lib vcle$(VCLVER).lib cp32mt.lib ws2_32.lib
!else
COMMON_LIBS = $(CODEGUARD_LIB) import32.lib cw32mt.lib ws2_32.lib
!endif
!else
!ifdef PASCAL
COMMON_LIBS = $(CODEGUARD_LIB) import32.lib vcl$(VCLVER).bpi vcle$(VCLVER).lib cp32mti.lib ws2_32.lib
!else
COMMON_LIBS = $(CODEGUARD_LIB) import32.lib cw32mti.lib ws2_32.lib
!endif
!endif
