#
#  16-bit build makefile used for ncxp16.dll.
#
#  This code was ported from the W9x (millenium) tree.  An effort was made to
#  closely match the millenium build.
#

#
# Get basic definitions (PATH_TOOLS16 etc.) from the makefile.plt
#

!include $(NTMAKEENV)\makefile.plt

#
# Setup common paths.
#

PATH      =$(PATH_TOOLS16);$(PATH)
DEST      =$(_OBJ_DIR)\$(TARGET_DIRECTORY)
SHARED    =..\shared
ASMDIR    = .\i386

#
# Compiler settings
#

CC        = cl16
INCLUDES  = -I$(SDK_INC16_PATH) -I..\shared -I..\win95 -I$(SDK_INC_PATH)
CFLAGS    = $(CFLAGS) -nologo -c -W3 -Zdp -Gs -Zl -Zi -ALw -GD
CCL       = $(CC) $(INCLUDES) $(CFLAGS)

INCENV    = $(INCLUDES:-I=)
INCENV    = $(INCENV: =;)

#
# Assembler settings.
#
#  The W9x build included the -coff option but it has been removed here (since it
#  generates errors).
#

AS        = ml
ADEFS     = $(ADEFS) -DIS_16
AFLAGS    = $(AFLAGS) -nologo -c -W3 -Cx -Sg -Zi -omf
ASL       = $(AS) $(ADEFS) $(AFLAGS)

#
# Linker settings
#

LINK      = link16
LFLAGS    = /L /MAP /NOPACKCODE /NOE /NODEFAULTLIBRARYSEARCH /ALIGN:16
LINKL     = $(LINK)

OBJ       = \
    $(DEST)\theapp.obj  \
    $(DEST)\strstri.obj \
    $(DEST)\thunk.obj

LINK_LIBS = \
    $(SDK_LIB16_PATH)\libw.lib \
    .\lib\ldllcew.lib


#
# Rules
#

all: $(DEST)\ncxp16.dll
    @echo -------- $(DEST) BUILD COMPLETE --------

#
# After the link use RC to stamp the dll as version 4.0.  This
# is required to make kernel call DllEntryPoint.  DllEntryPoint
# is required to properly setup the thunks.
#

$(DEST)\ncxp16.dll : $(OBJ)
    $(LINK)  @<<
        $(OBJ)
        $*.dll $(LFLAGS)
        $*.map
        $(LINK_LIBS)
        nconn16.def
<<
    set INCLUDE=$(INCENV)
    msdos32 rclater.16 -40 -dWIN16 ncxp16.rc $(DEST)\ncxp16.dll
    del $(*F).res
    
.cpp{$(DEST)}.obj :
    $(CCL) -Fd$(DEST)\$(*F).pdb -Fo$* $(*F).cpp

{$(SHARED)}.cpp{$(DEST)}.obj :
    $(CCL) -Fd$(DEST)\$(*F).pdb -Fo$* $(SHARED)\$(*F).cpp

{$(ASMDIR)}.asm{$(DEST)}.obj :
    $(ASL) -Fo$* $(ASMDIR)\$(*F).asm

