####
# makefile.sub - Subdirectory-specific makefile for new VCRT build process
#
#   Copyright (c) 1993-2001, Microsoft Corporation. All rights reserved.
#
# Purpose:
#   This makefile builds the C++ runtimes for Multi-thread, Single-Thread
#   and DLL.
#
#   This is a general-purpose makefile.  It is !INCLUDEd by the makefile
#   in each subdirectory (hence the .SUB extension).  All subdirectory-
#   specific make information should be embedded in the SOURCES file in
#   that subdirectory, not in this file.
#
#   Change to the appropriate subdirectory and type NMAKE DEPEND to
#   rebuild the dependencies.  These are stored in DEPEND.DEF in each
#   subdirectory.
#
###############################################################################

# STRIPLIN=2
## Change this to BLD_ASM=1 if you have MASM 6.11a or later and wish
## to re-build the assembler sources provided in this release.
#
#BLD_ASM=0
# STRIPLIN=0
BLD_ASM=1
# STRIPLIN=1

#
# Macro definitions:
#
###############################################################################

#
# Add .S and .I suffixes for assembler files on platforms other than x86
#

.SUFFIXES:
.SUFFIXES: .exe .obj .asm .s .i .c .cpp .cxx .res .rc

DBFLAGS = -Zi
!if "$(BLD_DLL)" == "1"
!ifndef DISABLE_MP_BUILD
DBFLAGS = -Z7
!ifdef NUMBER_OF_PROCESSORS
!if $(NUMBER_OF_PROCESSORS) > 1
CFLAGS = $(CFLAGS) -MP$(NUMBER_OF_PROCESSORS)
!endif
!endif
!endif
!endif

!if "$(BLD_DBG)" == "1"
CFLAGS=$(CFLAGS) $(DBFLAGS) -D_DEBUG -Od
!if "$(TARGET_CPU)"=="IA64"
AFLAGS=$(AFLAGS) -d debug
!else
AFLAGS=$(AFLAGS) -Zi -D_DEBUG
!endif
!else
CFLAGS=$(CFLAGS) -O1
# STRIPLIN=2
#!if "$(BLD_REL_NO_DBINFO)" != "1"
# STRIPLIN=0
!if "$(BLD_BBT)" == "1" || "$(BLD_REL_NO_DBINFO)" != "1"
# STRIPLIN=1
CFLAGS=$(CFLAGS) $(DBFLAGS)
!if "$(TARGET_CPU)"=="IA64"
AFLAGS=$(AFLAGS) -d debug
!else
AFLAGS=$(AFLAGS) -Zi
!endif
!endif
!endif

!if "$(BLD_BROWSE)" == "1"
CFLAGS=-FR$(OBJDIR)\ $(CFLAGS)
!if "$(TARGET_CPU)"!="IA64"
AFLAGS=-FR$(OBJDIR)\ $(AFLAGS)
!endif
!endif

# Tool definitions:

CC=cl
LIB=link -lib -nologo
!if "$(TARGET_CPU)"=="i386"
AS=ml
CFLAGS=$(CFLAGS) -Wp64
!elseif "$(TARGET_CPU)"=="IA64"
AS=ias
ACFLAGS= -D__assembler
CFLAGS=$(CFLAGS) -Wp64
AFLAGS=$(AFLAGS) -N so -X explicit
# ******** STRIPLIN=0 ********
!elseif "$(TARGET_CPU)"=="ALPHA"
AS=asaxp -Ialpha $(ML)
!elseif "$(TARGET_CPU)"=="ALPHA64"
AS=asaxp -Iaxp64 -Ialpha $(ML) -Ap64 -D_AXP64_
CFLAGS=$(CFLAGS) -Ap64 -Wp64
# ******** STRIPLIN=1 ********
!else
AS=cl
!endif

# ******** STRIPLIN=0 ********
LIB=$(LIB) -ignore:4006

!if "$(BLD_CRT_LTCG)"=="1"
CFLAGS=$(CFLAGS) -GL
LIB=$(LIB) -ltcg:nostatus
!endif
# ******** STRIPLIN=1 ********

#
# Source file definitions:
#
###############################################################################

A_INCLUDES=-I../h -I.
C_INCLUDES=-I../h

#
# Inference rules:
#
# (Due to the kind of dependencies used below, we must explicitly define
# inference rules to effect construction of the object files.)
#
###############################################################################

CXXFLAGS=$(CFLAGS) -GR -GX -d1Binl

!if "$(POST_BLD)"!="1"
!if "$(TARGET_CPU)"=="IA64"
CXXFLAGS=$(CXXFLAGS) -I../stdhpp64
# ******** STRIPLIN=0 ********
!elseif "$(TARGET_CPU)"=="ALPHA64"
CXXFLAGS=$(CXXFLAGS) -I../stdhpp64
# ******** STRIPLIN=1 ********
!else
CXXFLAGS=$(CXXFLAGS) -I../stdhpp
!endif
!endif


#
# Rules for end-user source build
#
#
# LSOURCES will override A_INCLUDES and C_INCLUDES for conv/ and tran/ subdirs.
#
###############################################################################

!if "$(POST_BLD)"=="1"
!INCLUDE makefile.inc
!else
!INCLUDE lsources.
!endif

.c{$(OBJDIR)}.obj::
    $(CC) $(CFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

!if "$(TARGET_CPU)"=="i386"

{i386}.c{$(OBJDIR)}.obj::
    $(CC) $(CFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

!elseif "$(TARGET_CPU)"=="IA64"

{ia64}.c{$(OBJDIR)}.obj::
    $(CC) $(CFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

# ******** STRIPLIN=0 ********
!elseif "$(TARGET_CPU)"=="ALPHA"

{alpha}.c{$(OBJDIR)}.obj::
    $(CC) $(CFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

!elseif "$(TARGET_CPU)"=="ALPHA64"

{alpha}.c{$(OBJDIR)}.obj::
    $(CC) $(CFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

{axp64}.c{$(OBJDIR)}.obj::
    $(CC) $(CFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

# ******** STRIPLIN=1 ********
!endif

.cpp{$(OBJDIR)}.obj::
    $(CC) $(CXXFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

!if "$(TARGET_CPU)"=="i386"

{i386}.cpp{$(OBJDIR)}.obj::
    $(CC) $(CXXFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

!IF $(BLD_ASM)==1

{i386}.asm{$(OBJDIR)}.obj:
!if "$(POST_BLD)"=="1"  # STRIPLIN!
    $(AS) $(AFLAGS) $(A_INCLUDES) -Fo$(OBJDIR)\ $< 
# STRIPLIN=0
!else
    $(AS) $(AFLAGS) $(A_INCLUDES) -Fo$(OBJDIR)\ $(MAKEDIR)\$< 
!endif
# STRIPLIN=1

!ENDIF

!elseif "$(TARGET_CPU)"=="IA64"

{ia64}.cpp{$(OBJDIR)}.obj::
    $(CC) $(CXXFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

{ia64}.s{$(OBJDIR)}.obj:
    $(CC) -E $(CFLAGS) $(ACFLAGS) $(A_INCLUDES) $< > $*.i
    $(AS) $(AFLAGS) -o$(OBJDIR)\$(@F) $*.i
    del $*.i

# ******** STRIPLIN=0 ********
!elseif "$(TARGET_CPU)"=="ALPHA"

{alpha}.cpp{$(OBJDIR)}.obj::
    $(CC) $(CXXFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

{alpha}.s{$(OBJDIR)}.obj:
    $(AS) $(AFLAGS) $(A_INCLUDES) -Fo $@ $<

!elseif "$(TARGET_CPU)"=="ALPHA64"

{alpha}.cpp{$(OBJDIR)}.obj::
    $(CC) $(CXXFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

{axp64}.cpp{$(OBJDIR)}.obj::
    $(CC) $(CXXFLAGS) $(C_INCLUDES) -Fo$(OBJDIR)\ $<

{alpha}.s{$(OBJDIR)}.obj:
    $(AS) $(AFLAGS) $(A_INCLUDES) -Fo $@ $<

{axp64}.s{$(OBJDIR)}.obj:
    $(AS) $(AFLAGS) $(A_INCLUDES) -Fo $@ $<

# ******** STRIPLIN=1 ********
!endif

# ******** STRIPLIN=0 ********
#
# Dependencies:
#
# NOTE: The inference rules cause the targets to actually be built; no
# commands are necessary below.
#
###############################################################################

$(OBJDIR)\$(CURDIR).lib: $(OBJS) $(OBJS_NOT_IN_LIB) $(OBJDIR)\$(CURDIR).rsp
!if "$(PRE_BLD)"=="1" && "$(DEVBUILD)"!="1"
    sed -f %CRT_BUILDDIR%\crt\prebuild\tools\win32\newline.sed $(OBJDIR)\$(CURDIR).rsp | sed -f %CRT_BUILDDIR%\crt\prebuild\tools\win32\delblank.sed >> temp.lst
    for /F %i in (temp.lst) do @%CRT_BUILDDIR%\crt\prebuild\libw32\tools\$(HOST_CPU)\whackline %i
    del temp.lst
!endif
    $(LIB) -out:$@ @$(OBJDIR)\$(CURDIR).rsp


$(OBJDIR)\$(CURDIR).rsp: lsources
    @echo Creating response file: <<$(OBJDIR)\$(CURDIR).rsp
$(OBJS)
<<keep

# ******** STRIPLIN=1 ********

!IF EXIST(special.mak)
!    INCLUDE special.mak    # Include special makefile additions, if any
!ENDIF

!IF EXIST(depend.def)
!    INCLUDE depend.def     # Include dependencies on .h files
!ENDIF

#<eof>