#
# $Id: build_lib.bor 74064 2006-08-16 08:37:30Z johnnyw $
#
# Rules	for building a static library
#
# Inputs:
# ~~~~~~~
# NAME - undecorated name of target
# CFLAGS - extra compiler flags	for building target
# CPPDIR - list	of directories containing source files
# OBJFILES - list of (non-system) object files
# LIBFILES - list of (non-system) libraries
# DEBUG	- if defined means building with debug information
# UNICODE - if defined when building a unicode lib
#

# Check if the output location was explicitly specified.
!if $d(BASE_BINDIR) || $d(BINDIR)
EXPLICIT_BINDIR = 1
!endif

!ifdef INSTALL_THIS_TARGET
!ifndef EXPLICIT_BINDIR
BINDIR = $(CORE_BINDIR)
!endif
!endif

!include <$(ACE_ROOT)\include\makeinclude\decorator.bor>
!include <$(ACE_ROOT)\include\makeinclude\outputdir.bor>
!include <$(ACE_ROOT)\include\makeinclude\compiler.bor>

!ifdef NAME
!ifndef TARGET
TARGET = $(BINDIR)\$(NAME)$(LIB_DECORATOR).lib
!endif
!endif

all: $(TARGET)
	@echo Do nothing >NUL

!ifdef TARGET
$(TARGET): $(OBJFILES)
	@$(MAKE_BINDIR)
	-@del $(TARGET) 2>NUL
	$(AR) $(LIB_LFLAGS) $(TARGET) @&&!
+ $(**: = &^
+ )
!
!endif

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

INSTALL_TYPES =	lib includes

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

!ifdef CPPDIR
.path.cpp = $(CPPDIR)
!endif

!ifdef CDIR
.path.c	= $(CDIR)
!endif

.path.$(OBJ_EXT) = $(OBJDIR)

!ifdef DEBUG
!ifndef NO_FULL_PATH
USE_FULL_PATH = 1
!endif
!endif

.cpp.$(OBJ_EXT):
	@$(MAKE_OBJDIR)
!ifdef USE_FULL_PATH
	@for /F "delims=;" %i in ('cd') do @echo $(CC) $(COMMON_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c -n$(@D) %i\$(<:.\=)
	@for /F "delims=;" %i in ('cd') do @$(CC) $(COMMON_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c -n$(@D) %i\$(<:.\=)
!else
	$(CC) $(COMMON_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c -n$(@D) $<
!endif

.c.$(OBJ_EXT):
	@$(MAKE_OBJDIR)
!ifdef USE_FULL_PATH
	@for /F "delims=;" %i in ('cd') do @echo $(CC) $(COMMON_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c -n$(@D) %i\$(<:.\=)
	@for /F "delims=;" %i in ('cd') do @$(CC) $(COMMON_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c -n$(@D) %i\$(<:.\=)
!else
	$(CC) $(COMMON_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c -n$(@D) $<
!endif

.autodepend
