#----------------------------------------------------------------------------
#       Borland Makefile
#
# This file was automatically generated by MPC.  Any changes made directly to
# this file will be lost the next time it is generated.
#
#----------------------------------------------------------------------------
<%marker(top)%>
<%foreach(configurations)%>
!ifdef <%normalize(uc(configuration))%>
OCFLAGS      = <%if(optimize)%>-O2<%else%><%if(debug_prj)%>-v -y -Od -vi- -k<%foreach(debug_macros)%> -D<%debug_macro%><%endfor%><%endif%><%endif%><%foreach(defines)%> -D<%define%><%endfor%>
CFG_DIR      = <%intermediate_dir%>\\
LIBMODIFIER  = <%if(use_lib_modifier)%><%lib_modifier%><%endif%>
EXEMODIFIER  = <%if(use_exe_modifier)%><%lib_modifier%><%endif%>
<%if(type_is_static)%>
STATIC_CFG   = 1
<%endif%>
<%if(type_is_static || need_staticflags)%>
<%if(staticflags)%>
STATIC_FLAGS =<%foreach(staticflags)%> -D<%staticflag%><%endfor%>
<%endif%>
<%else%>
<%if(dynamicflags)%>
DYN_FLAGS    =<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%>
<%endif%>
<%endif%>
<%if(postlinkrmext)%>
POSTLINKRM   = <%postlinkrmext%>
<%endif%>
<%if(exename)%>
EXEOUTPUTDIR = <%if(exeout)%><%exeout%><%if(windows_style)%>\<%output_dir("Debug")%><%endif%><%else%><%if(windows_style)%><%output_dir("Debug")%><%else%><%output_dir(".")%><%endif%><%endif%>\\
<%endif%>
!else
<%endfor%>
!error You must define one of these valid configurations:<%foreach(configurations)%> <%normalize(uc(configuration))%><%endfor%>
<%foreach(configurations)%>
!endif
<%endfor%>

!ifdef UNICODE
UC_CFLAGS    = <%unicode_flags%>
UNICODE_DIR  = Unicode\\
UC_MAIN      = w
ULIBMODIFIER = <%unicode_lib_modifier%>
UEXEMODIFIER = <%unicode_lib_modifier%>
!endif

!ifdef CODEGUARD
CG_CFLAGS = -vG
CG_LIB    = cg32.lib
!endif

<%if(use_vcl)%>
STARTUP_LETTER = <%if(exename)%>w<%else%><%startup_letter%><%endif%>
<%else%>
VCL_CFLAGS     = -D_NO_VCL
STARTUP_LETTER = <%startup_letter%>
<%endif%>
STARTUP_OBJ    = c0$(STARTUP_LETTER)32$(UC_MAIN)$(OBJ_EXT)

OBJ_EXT      = <%obj_ext%>
DLL_EXT      = <%dll_ext%>
LIB_EXT      = <%lib_ext%>
EXE_EXT      = <%exe_ext%>
CC           = <%cc%>
RC           = <%rc%>
LINK         = <%link%>
TLIB         = <%tlib%>
THREADFLAGS  = <%thflags%>
DLLFLAGS     = <%dllflags%>
LIBFLAGS     = <%libflags%>
EXEFLAGS     = <%exeflags%>
WARNFLAGS    = <%warnflags%>
CCFLAGS      = <%ccflags%><%if(type_is_binary)%> <%binary_compile_flags("-tWR -tWD")%><%endif%><%if(compile_flags)%> <%compile_flags%><%endif%>

INTERMEDIATE = $(CFG_DIR)$(UNICODE_DIR)<%noextension(project_name)%>
<%if(exename)%>
NAME         = <%exename%>$(EXEMODIFIER)
<%else%>
<%if(sharedname)%>
NAME         = <%libname_prefix%><%sharedname%>$(LIBMODIFIER)$(ULIBMODIFIER)
<%else%>
<%if(staticname)%>
NAME         = <%libname_prefix%><%staticname%>$(LIBMODIFIER)$(ULIBMODIFIER)
<%endif%>
<%endif%>
<%endif%>
CPPDIR       = <%cppdir%>
RESDIR       = <%rcdir%>
<%if(exename || sharedname || staticname)%>

OBJFILES = \
<%foreach(source_files)%>
           "$(INTERMEDIATE)\<%transdir(source_file)%><%basenoextension(source_file)%>$(OBJ_EXT)"<%fornotlast(" \\")%>
<%endfor%>
<%endif%>
<%if(libpaths)%>

LFLAGS   = \
<%if(linkflags)%>
        <%linkflags%> \
<%endif%>
<%if(StackReserveSize)%>
           /S:<%StackReserveSize%> \
<%endif%>
<%if(StackCommitSize)%>
           /Sc:<%StackCommitSize%> \
<%endif%>
<%if(!optimize)%>
           -v<%if(libpaths)%> \<%endif%>
<%endif%>
<%foreach(libpaths)%>
           -L"<%libpath%>" -j"<%libpath%>"<%fornotlast(" \\")%>
<%endfor%>
<%endif%>

LIBFILES = \
<%foreach(reverse(libs))%>
           <%libname_prefix%><%lib%>$(LIBMODIFIER)$(ULIBMODIFIER)$(LIB_EXT) \
<%endfor%>
<%foreach(reverse(lit_libs))%>
           <%lit_lib%>$(LIB_EXT) \
<%endfor%>
<%foreach(reverse(pure_libs))%>
           <%pure_lib%> \
<%endfor%>
           $(CG_LIB) <%common_libs%>
<%if(resource_files)%>

!ifndef STATIC_CFG
RESOURCE = \
<%foreach(resource_files)%>
           $(INTERMEDIATE)\<%transdir(resource_file)%><%basenoextension(resource_file)%>.res<%fornotlast(" \\")%>
<%endfor%>
<%if(includes)%>

RC_FLAGS = \
<%foreach(includes)%>
        -i"<%include%>"<%fornotlast(" \\")%>
<%endfor%>
<%endif%>
!endif
<%endif%>
<%if(pch_header)%>

# Borland precompiled headers can choke on some header files.
# Set NO_USE_PCH if you do not want to use precompiled headers.
!ifndef NO_USE_PCH
PCH_CFLAGS = \
<%foreach(pch_defines)%>
             -D<%pch_define%> \
<%endfor%>
             -H=$(INTERMEDIATE)\<%noextension(project_name)%>.csm -Hh=<%pch_header%>
!endif
<%endif%>

CFLAGS = \
<%foreach(cflags)%>
         <%cflag%> \
<%endfor%>
<%foreach(common_flags)%>
         <%common_flag%> \
<%endfor%>
<%foreach(macros common_defines)%>
         -D<%macro%> \
<%endfor%>
<%foreach(includes)%>
         -I"<%include%>" \
<%endfor%>
         $(PCH_CFLAGS) \
         $(VCL_CFLAGS)

<%marker(macros)%>
<%if(exename)%>
OUTPUTDIR = $(EXEOUTPUTDIR)
all:<%if(prebuild)%> __prebuild__<%endif%> $(OUTPUTDIR)$(NAME)$(EXE_EXT)<%if(postbuild)%> __postbuild__<%endif%>

$(OUTPUTDIR)$(NAME)$(EXE_EXT): $(OBJFILES) $(RESOURCE)
	@if not exist "$(OUTPUTDIR)" mkdir "$(OUTPUTDIR)"
<%if(prelink)%>
	<%eval(prelink)%>
<%endif%>
	$(LINK) @&&!
	$(EXEFLAGS) $(LFLAGS) $(STARTUP_OBJ) $(OBJFILES), $(OUTPUTDIR)$(NAME)$(EXE_EXT),, $(LIBFILES),, $(RESOURCE)
!

<%endif%>
<%if(sharedname)%>
!ifndef STATIC_CFG
OUTPUTDIR = <%if(dllout)%><%dllout%><%else%><%libout%><%endif%>\\
all:<%if(prebuild)%> __prebuild__<%endif%> $(OUTPUTDIR)$(NAME)$(DLL_EXT)<%if(postbuild)%> __postbuild__<%endif%>

$(OUTPUTDIR)$(NAME)$(DLL_EXT): $(OBJFILES) $(RESOURCE)
	@if not exist "$(OUTPUTDIR)" mkdir "$(OUTPUTDIR)"
<%if(prelink)%>
	<%eval(prelink)%>
<%endif%>
	$(LINK) @&&!
	$(DLLFLAGS) $(LFLAGS) $(STARTUP_OBJ) $(OBJFILES), $(OUTPUTDIR)$(NAME)$(DLL_EXT),, $(LIBFILES),, $(RESOURCE)
!
!endif

<%endif%>
<%if(staticname)%>
!ifdef STATIC_CFG
OUTPUTDIR = <%libout%>\\
all:<%if(prebuild)%> __prebuild__<%endif%> $(OUTPUTDIR)$(NAME)$(LIB_EXT)<%if(postbuild)%> __postbuild__<%endif%>

$(OUTPUTDIR)$(NAME)$(LIB_EXT): $(OBJFILES)
	@if not exist "$(OUTPUTDIR)" mkdir "$(OUTPUTDIR)"
	$(TLIB) $(LIBFLAGS) $(OUTPUTDIR)$(NAME)$(LIB_EXT) @&&!
+ $(**: = &^
+ )
!
!endif

<%endif%>
<%if(!exename && !sharedname && !staticname)%>
all:<%if(prebuild)%> __prebuild__<%endif%><%if(postbuild)%> __postbuild__<%endif%>
	@-rem

<%endif%>
<%if(custom_types)%>
GENERATED_DIRTY =<%foreach(custom_types)%><%foreach(custom_type->input_files)%><%if(custom_type->input_file->output_files)%><%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%><%endif%><%endfor%><%endfor%>
<%foreach(custom_types)%>
<%if(custom_type->libpath)%>
PATH = $(PATH);<%custom_type->libpath%>
<%endif%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->output_files)%>
<%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>: <%custom_type->input_file%><%if(custom_type->input_file->dependencies)%> <%custom_type->input_file->dependencies%><%endif%>
<%if(flag_overrides(custom_type->input_file, gendir))%>
        @if not exist "<%flag_overrides(custom_type->input_file, gendir)%>" mkdir "<%flag_overrides(custom_type->input_file, gendir)%>"
<%endif%>
	<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%if(custom_type->output_option)%><%custom_type->input_file%> <%custom_type->output_option%> $@<%else%><%custom_type->input_file%><%endif%>
<%if(flag_overrides(custom_type->input_file, postcommand))%>
<%foreach(custom_type->input_file)%>
	<%flag_overrides(custom_type->input_file, postcommand)%>
<%endfor%>
<%else%>
<%if(custom_type->postcommand)%>
<%foreach(custom_type->input_file)%>
	<%custom_type->postcommand%>
<%endfor%>
<%endif%>
<%endif%>
<%if(pch_header)%>
<%if(custom_type->pch_postrule)%>
<%foreach(custom_type->input_file->source_output_files)%>
	@echo \#include "<%pch_header%>" > temporary.src
	@type <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%> >> temporary.src
	@move /y temporary.src <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>
<%endfor%>
<%endif%>
<%endif%>

<%endif%>
<%endfor%>
<%endfor%>
<%if(exename || sharedname || staticname)%>
<%if(source_files)%>
$(OBJFILES): $(GENERATED_DIRTY)
<%else%>
all:<%if(prebuild)%> __prebuild__<%endif%> $(GENERATED_DIRTY)<%if(postbuild)%> __postbuild__<%endif%>
<%endif%>
<%else%>
all:<%if(prebuild)%> __prebuild__<%endif%> $(GENERATED_DIRTY)<%if(postbuild)%> __postbuild__<%endif%>
<%endif%>

<%endif%>
generated: $(GENERATED_DIRTY)
	@-rem

.path$(OBJ_EXT) = $(INTERMEDIATE)

.path.cpp = $(CPPDIR)
.cpp$(OBJ_EXT):
	@if not exist "$(INTERMEDIATE)" mkdir "$(INTERMEDIATE)"
        $(CC) $(DYN_FLAGS) $(STATIC_FLAGS) $(OCFLAGS) $(CG_CFLAGS) $(UC_CFLAGS) $(THREADFLAGS) $(CCFLAGS) $(CFLAGS) $(WARNFLAGS) -c -n$(@D) $<

.path.cxx = $(CPPDIR)
.cxx$(OBJ_EXT):
	@if not exist "$(INTERMEDIATE)" mkdir "$(INTERMEDIATE)"
        $(CC) $(DYN_FLAGS) $(STATIC_FLAGS) $(OCFLAGS) $(CG_CFLAGS) $(UC_CFLAGS) $(THREADFLAGS) $(CCFLAGS) $(CFLAGS) $(WARNFLAGS) -c -n$(@D) $<

.path.cc = $(CPPDIR)
.cc$(OBJ_EXT):
	@if not exist "$(INTERMEDIATE)" mkdir "$(INTERMEDIATE)"
        $(CC) $(DYN_FLAGS) $(STATIC_FLAGS) $(OCFLAGS) $(CG_CFLAGS) $(UC_CFLAGS) $(THREADFLAGS) $(CCFLAGS) $(CFLAGS) $(WARNFLAGS) -c -n$(@D) $<

.path.C = $(CPPDIR)
.C$(OBJ_EXT):
	@if not exist "$(INTERMEDIATE)" mkdir "$(INTERMEDIATE)"
        $(CC) $(DYN_FLAGS) $(STATIC_FLAGS) $(OCFLAGS) $(CG_CFLAGS) $(UC_CFLAGS) $(THREADFLAGS) $(CCFLAGS) $(CFLAGS) $(WARNFLAGS) -c -n$(@D) $<

.path.c = $(CPPDIR)
.c$(OBJ_EXT):
	@if not exist "$(INTERMEDIATE)" mkdir "$(INTERMEDIATE)"
        $(CC) $(DYN_FLAGS) $(STATIC_FLAGS) $(OCFLAGS) $(CG_CFLAGS) $(UC_CFLAGS) $(THREADFLAGS) $(CCFLAGS) $(CFLAGS) $(WARNFLAGS) -c -n$(@D) $<

<%foreach(source_files)%>
<%if(transdir(source_file) || flag_overrides(source_file, buildflags))%>
"$(INTERMEDIATE)\<%transdir(source_file)%><%basenoextension(source_file)%>$(OBJ_EXT)":
	@if not exist "$(INTERMEDIATE)\<%transdir(source_file)%>" mkdir "$(INTERMEDIATE)\<%transdir(source_file)%>"
	$(CC) <%if(flag_overrides(source_file, buildflags))%><%flag_overrides(source_file, buildflags)%> <%endif%>$(DYN_FLAGS) $(STATIC_FLAGS) $(OCFLAGS) $(CG_CFLAGS) $(UC_CFLAGS) $(THREADFLAGS) $(CCFLAGS) $(CFLAGS) $(WARNFLAGS) -c -n$(@D) <%source_file%>

<%endif%>
<%endfor%>
<%if(resource_files)%>
!ifndef STATIC_CFG
.path.res = $(INTERMEDIATE)

.path.rc = $(RESDIR)
.rc.res:
	@if not exist "$(INTERMEDIATE)" mkdir "$(INTERMEDIATE)"
        $(RC) $(RC_FLAGS) -fo$@ $<

<%foreach(resource_files)%>
<%if(transdir(resource_file))%>
"$(INTERMEDIATE)\<%transdir(resource_file)%><%basenoextension(resource_file)%>.res":
	@if not exist "$(INTERMEDIATE)\<%transdir(resource_file)%>" mkdir "$(INTERMEDIATE)\<%transdir(resource_file)%>"
	$(RC) -fo$@ <%resource_file%>

<%endif%>
<%endfor%>
!endif

<%endif%>
clean:
        @if exist "$(INTERMEDIATE)" rmdir /s/q $(INTERMEDIATE)

realclean: clean
<%foreach(custom_types)%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->output_files)%>
<%foreach(custom_type->input_file->output_files)%>
<%if(flag_overrides(custom_type->input_file, gendir))%>
        @del "<%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->output_file)%>" 2>NUL
<%else%>
        @del "<%custom_type->input_file->output_file%>" 2>NUL
<%endif%>
<%endfor%>
<%endif%>
<%endfor%>
<%endfor%>
<%if(exename)%>
        @del "$(OUTPUTDIR)$(NAME)$(EXE_EXT)" del "$(OUTPUTDIR)$(NAME)$(EXE_EXT)" 2>NUL
<%else%>
<%if(sharedname)%>
        @del "$(OUTPUTDIR)$(NAME)$(DLL_EXT)" del "$(OUTPUTDIR)$(NAME)$(DLL_EXT)" 2>NUL
<%endif%>
<%if(staticname)%>
        @del "$(OUTPUTDIR)$(NAME)$(LIB_EXT)" del "$(OUTPUTDIR)$(NAME)$(LIB_EXT)" 2>NUL
<%endif%>
<%endif%>
<%if(exename || sharedname || staticname)%>
        @del "$(OUTPUTDIR)$(NAME)$(POSTLINKRM)" 2>NUL
<%endif%>
<%if(postclean)%>
	-<%eval(postclean)%>
<%endif%>

<%if(prebuild)%>
__prebuild__:
	@<%eval(prebuild)%>

<%endif%>
<%if(postbuild)%>
__postbuild__:
	@<%eval(postbuild)%>

<%endif%>
<%marker(local)%>
<%marker(bottom)%>
