#******************************************************************************
#  Makefile for the PRINTER directory
#
#       SCCSID = @(#)makefile   6.10 91/09/26
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1989
#       Copyright (c) Microsoft Corporation 1987, 1989
#
#       All Rights Reserved
#
#******************************************************************************

#
# ******  NOTE  ******
#
#        If you are using a SED command with TAB characters, many editors
#        will expand tabs causing unpredictable results in other programs.
#
#        Documentation:
#
#        Using SED command with TABS. Besure to invoke set tab save option
#        on your editor. If you don't, the program 'xyz' will not work
#        correctly.
#

#****************************************************************************
#  Dot directive definition area (usually just suffixes)
#****************************************************************************

.SUFFIXES:      .com .sys .exe .obj .lst .c .asm .def .lrf .lnk .bbs

#****************************************************************************
#  Environment Setup for the component(s).
#****************************************************************************

#
# Conditional Setup Area and User Defined Macros
#


#
# Compiler Location w/ includes, libs and tools
#

H         = ..\..\..\h
RMH       = ..\resource\rsm_h
INC       = ..\..\..\inc
DOSINC    = ..\..\dos\dosinc
LIB       = ..\..\..\lib
TOOLSPATH = ..\..\..\tools
RMLIB     = ..\resource\rmcalls

#
# Since the compiler/linker and other tools use environment
# variables ( INCLUDE, LIB, etc ) in order to get the location of files,
# the following line will check the environment for the LIFE of the
# makefile and will be specific to this set of instructions. All MAKEFILES
# are requested to use this format to insure that they are using the correct
# level of files and tools.
#

!if [set INCLUDE=$(INC);$(DOSINC);$(H);$(RMH)] || [set LIB=$(LIB);$(RMLIB)] || \
  [set PATH=$(TOOLSPATH)]
!endif


#
# Compiler/tools Macros
#

AS=masm
CC=cl
IMPLIB=implib
IPF=ipfc
LIBUTIL=lib
LINK=link
MAPSYM=mapsym
RC=rc

#
# Compiler and Linker Options
#

!ifndef smp
AFLAGS= -Mx -t -z -DALIGNCODE
!else
AFLAGS= -Mx -t -z -DALIGNCODE -DSMP
!endif

AINC   = -I. -I$(INC) -I$(DOSINC)
CFLAGS = -Fc /W3 -c -Asnw -G2s -Zl -Zp -Osegli -nologo
LFLAGS = /noe /nod /map /EXEPACK /ALIGN:16 /FAR
LIBS   = $(RMLIB)\rmcalls.lib

#****************************************************************************
# Set up Macros that will contain all the different dependencies for the
# executables and dlls etc. that are generated.
#****************************************************************************

# *** LINK STEP REQUIREMENTS ***
# PRTDDTSK MUST BE FIRST FOR DEVICE DRIVER HEADER TO BE FIRST IN DATA SEG.
# PRTHWINT MUST BE LAST FOR INIT DEVICE DRIVER ROUTINE MEMORY TO BE RETURNED.

OBJ0 =  prtddtsk.obj prtioctl.obj prtplpt.obj prtcommn.obj prtsegs.obj
OBJ1 =  prthwiat.obj prteisai.obj prtrm.obj prtpci.obj
OBJ2 =  prthwint.obj prtrm.obj

OBJS01 = $(OBJ0) $(OBJ1)
OBJS02 = $(OBJ0) $(OBJ2)

DEF01  = print01.def
DEF02  = print02.def

#****************************************************************************
#   Setup the inference rules for compiling and assembling source code to
#   obejct code.
#****************************************************************************

.asm.obj:
        $(AS) $(AFLAGS) $(AINC) $*.asm;

.asm.lst:
        $(AS) -l $(AFLAGS) $(AINC) $*.asm;

.c.obj:
        $(CC) $(CFLAGS) -Fo$*.obj -I$(RMH) -c $*.c

.c.lst:
        $(CC) $(CFLAGS) -Fc$*.cod -Fo$*.obj -I$(RMH) -c $*.c


#****************************************************************************
#   Target Information
#****************************************************************************
#
# This is a very important step. The following small amount of code MUST
# NOT be removed from the program. The following directive will do
# dependency checking every time this component is built UNLESS the
# following is performed:
#                    A specific tag is used -- ie. all
#
# This allows the developer as well as the B & I group to perform incremental
# build with a degree of accuracy that has not been used before.
# There are some instances where certain types of INCLUDE files must be
# created first. This type of format will allow the developer to require
# that file to be created first. In order to achive that, all that has to
# be done is to make the DEPEND.MAK tag have your required target. Below is
# an example:
#
#    depend.mak:   { your file(s) } dephold
#
# Please DON'T remove the following line
#


#
# Should be the default tag for all general processing
#

all:    print01.sys print02.sys

clean:
        if exist *.lnk  del *.lnk
        if exist *.obj  del *.obj
        if exist *.def  del *.def
        if exist *.map  del *.map
        if exist *.old  del *.old
        if exist *.lst  del *.lst
        if exist *.sym  del *.sym
        if exist *.sys  del *.sys

#*****************************************************************************
#   Specific Description Block Information
#*****************************************************************************

# This section would only be for specific direction as to how to create
# unique elements that are necessary to the build process. This could
# be compiling or assembling, creation of DEF files and other unique
# files.
# If all compiler and assembly rules are the same, use an inference rule to
# perform the compilation.
#
print01.def: makefile
        @echo Make .DEF file
        @echo ; *********************************************** >  print01.def
        @echo ; *                                             * >> print01.def
        @echo ; *         IBM/Microsoft Confidential          * >> print01.def
        @echo ; *                                             * >> print01.def
        @echo ; *   Copyright (c) IBM Corporation  1987, 1994 * >> print01.def
        @echo ; *             All Rights Reserved             * >> print01.def
        @echo ; *                                             * >> print01.def
        @echo ; *********************************************** >> print01.def
        @echo LIBRARY PRINT01                                   >> print01.def
        @echo PROTMODE                                          >> print01.def
        @echo SEGMENTS                                          >> print01.def
        @echo    DSEG    CLASS 'DATA'  IOPL                     >> print01.def
        @echo    _DATA   CLASS 'DATA'  IOPL                     >> print01.def
        @echo    CONST   CLASS 'CONST' IOPL                     >> print01.def
        @echo    _BSS    CLASS 'BSS'   IOPL                     >> print01.def
        @echo    CSEG    CLASS 'CODE'  IOPL                     >> print01.def
        @echo    RMCode  CLASS 'CODE'  IOPL                     >> print01.def
        @echo    _TEXT   CLASS 'CODE'  IOPL                     >> print01.def
        @echo    SWAPSEG CLASS 'CODE'  IOPL                     >> print01.def
        @echo IMPORTS                                           >> print01.def
        @echo    DOSIODELAYCNT = DOSCALLS.427                   >> print01.def

print02.def: makefile
        @echo Make .DEF file
        @echo ; *********************************************** >  print02.def
        @echo ; *                                             * >> print02.def
        @echo ; *         IBM/Microsoft Confidential          * >> print02.def
        @echo ; *                                             * >> print02.def
        @echo ; *   Copyright (c) IBM Corporation  1987, 1994 * >> print02.def
        @echo ; *             All Rights Reserved             * >> print02.def
        @echo ; *                                             * >> print02.def
        @echo ; *********************************************** >> print02.def
        @echo LIBRARY PRINT02                                   >> print02.def
        @echo PROTMODE                                          >> print02.def
        @echo SEGMENTS                                          >> print02.def
        @echo    DSEG    CLASS 'DATA'  IOPL                     >> print02.def
        @echo    _DATA   CLASS 'DATA'  IOPL                     >> print02.def
        @echo    CONST   CLASS 'CONST' IOPL                     >> print02.def
        @echo    _BSS    CLASS 'BSS'   IOPL                     >> print02.def
        @echo    CSEG    CLASS 'CODE'  IOPL                     >> print02.def
        @echo    RMCode  CLASS 'CODE'  IOPL                     >> print02.def
        @echo    _TEXT   CLASS 'CODE'  IOPL                     >> print02.def
        @echo    SWAPSEG CLASS 'CODE'  IOPL                     >> print02.def
        @echo IMPORTS                                           >> print02.def
        @echo    DOSIODELAYCNT = DOSCALLS.427                   >> print02.def


# Parallel Port Device Driver Build

print01.sys:    $(OBJS01) $(DEF01) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBJ0) +
$(OBJ1)
$@
$*.map
$(LIBS)
$*.def
<<keep
        $(MAPSYM) $*.map

print02.sys:    $(OBJS02) $(DEF02) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBJ0) +
$(OBJ2)
$@
$*.map
$(LIBS)
$*.def
<<keep
        $(MAPSYM) $*.map

#****************************************************************************
