# Makefile for building the <%if(exename)%><%exename%> exe<%endif%><%if(sharedname)%><%sharedname%> library<%else%><%if(staticname)%><%staticname%> library<%endif%><%endif%> with Borland C++ Make

<%marker(top)%>
<%if(exename)%>
NAME = <%exename%>
<%else%>
<%if(sharedname || staticname)%>
NAME = <%if(sharedname)%><%sharedname%><%else%><%staticname%><%endif%>
<%endif%>
<%endif%>

NO_FULL_PATH=1
<%if(exename || sharedname || staticname)%>
<%if(source_files)%>

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

LFLAGS = \
<%if(linkflags)%>
        <%linkflags%> \
<%endif%>
<%if(StackReserveSize)%>
        /S:<%StackReserveSize%> \
<%endif%>
<%if(StackCommitSize)%>
        /Sc:<%StackCommitSize%> \
<%endif%>
<%foreach(libpaths)%>
        -L"<%libpath%>" \
        -j"<%libpath%>" <%fornotlast(" \\")%>
<%endfor%>
<%endif%>
<%if(libs || lit_libs || pure_libs)%>

LIBFILES = \
<%foreach(pure_libs)%>
	<%pure_lib%> \
<%endfor%>
<%foreach(lit_libs)%>
	<%lit_lib%>.lib \
<%endfor%>
<%foreach(reverse(libs))%>
	<%lib%>$(LIB_DECORATOR).lib \
<%endfor%>
	$(DUMMY_VALUE_NOT_ENDING_IN_BACKSLASH)
<%endif%>
<%if(rcdir)%>

RESDIR = <%rcdir%>
<%endif%>
<%if(resource_files)%>

RESOURCE =<%foreach(resource_files)%> $(OBJDIR)\<%basenoextension(resource_file)%>.res<%endfor%>

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

<%endif%>

!ifdef STATIC
<%if(staticflags)%>
LIB_FLAGS = \
<%foreach(staticflags)%>
        -D<%staticflag%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
!else
<%if(dynamicflags)%>
DLL_FLAGS = \
<%foreach(dynamicflags)%>
        -D<%dynamicflag%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
!endif

CFLAGS = \
<%if(pch_header)%>
<%foreach(pch_defines)%>
# Borland precompiled headers choke on several tao header files.
# For example, any place that uses ACE_LIB_TEXT().
#	-D<%pch_define%> \
<%endfor%>
<%endif%>
<%if(compile_flags)%>
        <%compile_flags%> \
<%endif%>
<%foreach(macros)%>
	-D<%macro%> \
<%endfor%>
<%foreach(includes)%>
	-I"<%include%>" \
<%endfor%>
	$(LIB_FLAGS) \
	$(DLL_FLAGS)
<%if(pch_header)%>

# Borland precompiled headers choke on several tao header files.
# For example, any place that uses ACE_LIB_TEXT().
#PCH_HEADER=<%pch_header%>
<%endif%>
<%if(cppdir)%>

CPPDIR = <%cppdir%>
CDIR   = <%cppdir%>
<%endif%>
<%if(header_files || template_files || inline_files || idl_files)%>

INCDIR_NAME = <%relwd%>
<%endif%>
<%foreach(custom_types)%>

#
# <%custom_type%> rules
#

<%if(cutom_type->libpath)%>
PATH := $(PATH);<%custom_type->libpath%>

<%endif%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->output_files)%>

<%custom_type%>_<%forcount(custom_type->input_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%>
$(<%custom_type%>_<%forcount(custom_type->input_files)%>): <%custom_type->input_file%>
<%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)%> 2> nul
<%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%> <%custom_type->input_file%> <%if(custom_type->output_option)%><%custom_type->output_option%> $@<%endif%>
<%if(flag_overrides(custom_type->input_file, postcommand))%>
<%foreach(custom_type->input_file->output_files)%>
	<%flag_overrides(custom_type->input_file, postcommand)%>
<%endfor%>
<%else%>
<%if(custom_type->postcommand)%>
<%foreach(custom_type->input_file->output_files)%>
	<%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%>

all: $(<%custom_type%>_<%forcount(custom_type->input_files)%>)

customclean_<%custom_type%>_<%forcount(custom_type->input_files)%>:
	@del $(<%custom_type%>_<%forcount(custom_type->input_files)%>) 2>nul

clean: customclean_<%custom_type%>_<%forcount(custom_type->input_files)%>

realclean: customclean_<%custom_type%>_<%forcount(custom_type->input_files)%>

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

#
# Override defaults in outputdir.bor
#
<%if(INSTALL_THIS_TARGET)%>
INSTALL_THIS_TARGET = 1

<%endif%>
<%marker(macros)%>
INCLUDES_INSTALL=1
<%if(exename)%>

<%if(install)%>
# We use BINDIR for install instead of BASE_BINDIR, because
# this is the location for all scripts too.
BINDIR = <%install%>
<%else%>
BASE_BINDIR = .
<%endif%>

!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor>
<%else%>
<%if(sharedname || staticname)%>
BINDIR = <%if(dllout)%><%dllout%><%else%><%libout%><%endif%>

!include <$(ACE_ROOT)\include\makeinclude\build_library.bor>
<%else%>
INSTALL_TYPES = includes

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

all:
	@-rem
<%endif%>
<%endif%>
<%if(header_files || template_files || inline_files || idl_files || pidl_files)%>

includes_install: $(INCLUDES)
<%foreach(header_files template_files inline_files idl_files pidl_files)%>
	-@if not exist $(INSTALL_DIR)\include\$(INCDIR_NAME)\<%dirname(header_file)%> mkdir $(INSTALL_DIR)\include\$(INCDIR_NAME)\<%dirname(header_file)%>
	-&copy /Y <%header_file%> $(INSTALL_DIR)\include\$(INCDIR_NAME)\<%header_file%> 1> NUL
<%endfor%>
<%else%>

includes_install:
	@echo Nothing to install.
<%endif%>

realclean:
        @-rem

<%marker(bottom)%>
