# SCCSID = %W% %E%
#/***********************************************************************/
#/*                                                                     */
#/* Driver Name: IBM1S506.ADD - Adapter Driver for ST506/IDE DASD       */
#/*              IBM2IDE.ADD - Adapter Driver for MCA IDE DASD          */
#/*              ------------------------------------------------       */
#/*                                                                     */
#/* Source File Name: MAKEFILE                                          */
#/*                                                                     */
#/* Descriptive Name: MAKEFILE for IBM1S506.ADD & IBM2IDE.ADD           */
#/*                                                                     */
#/* Function:                                                           */
#/*                                                                     */
#/*                                                                     */
#/*---------------------------------------------------------------------*/
#/*                                                                     */
#/* Copyright (C) 1992 IBM Corporation                                  */
#/*                                                                     */
#/* DISCLAIMER OF WARRANTIES.  The following [enclosed] code is         */
#/* provided to you solely for the purpose of assisting you in          */
#/* the development of your applications. The code is provided          */
#/* "AS IS", without warranty of any kind. IBM shall not be liable      */
#/* for any damages arising out of your use of this code, even if       */
#/* they have been advised of the possibility of such damages.          */
#/*                                                                     */
#/*---------------------------------------------------------------------*/
#/*                                                                     */
#/* Change Log                                                          */
#/*                                                                     */
#/* Mark    Date      Programmer  Comment                               */
#/* ----    ----      ----------  -------                               */
#/* @98451  06/21/94  EFB         Added Suspend/Resume in s506osm2.c    */
#/* @98451  09/15/94  EFB         Added Resource Manager                */
#/* @117508 04/03/95  EFB         Add IBM2IDE.ADD compilation           */
#/* @129765 07/07/95  VBR         More PCI configuration support,       */
#/*                               RZ1000.  Broke S506OEM into S506OEM,  */
#/*                               always resident and S506OEMI,         */
#/*                               resident during DD init only.         */
#/* @V155162 05/24/95 VBR         Thinkpad docking/swapping IDE update. */
#/* @V172802 11/21/96 VBR         Deleted DockII command line support   */
#/*          at the DockII's IDE bus cannot reliabily dock and undock.  */
#/*          Therefore we only support DockII resident IDE devices      */
#/*          acutally detected during cold boot.                        */
#/* @V192176 02/20/98             >8.4GB support.
#/***********************************************************************/

#
#
#       You can optionally generate the listing files for the device driver.
#
#          make  [option]
#
#            option:     list         -> create listings
#                        ibm1s506.add -> create ibm1s506.add
#                        ibm2ide.add  -> create ibm2ide.add
#
#            default:  create ibm1s506.add & ibm2ide.add
#
# ******  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:
.SUFFIXES: .com .add .exe .obj .mbj .asm .inc .def .lnk .lrf .crf .ref
.SUFFIXES: .lst .sym .map .c .h .lib

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

#
# Conditional Setup Area and User Defined Macros
#

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

DOSINC    = ..\..\..\..\dos\dosinc
INIT      = ..\..\..\..\dos\init
TASK      = ..\..\..\..\dos\task
INC       = ..\..\..\..\..\inc
H         = ..\..\..\..\..\h
LIB       = ..\..\..\..\..\lib
TOOLSPATH = ..\..\..\..\..\tools
DISKH     = ..\..\diskh
DHLIB     = ..\..\devhelp
ADDLIB    = ..\..\addcalls
RMLIB     = ..\..\..\resource\rmcalls
APM_H     = ..\..\..\thinkpad\dockii\apmcalls
APM_LIB   = ..\..\..\thinkpad\dockii\apmcalls
PCM_H     = ..\..\..\pcmcia\autocfg

#
# 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=.;$(H);$(DOSINC);$(DISKH);$(ADDLIB);$(APM_H);$(PCM_H);$(INIT);$(TASK);$(INC)] || \
    [set LIB=$(ADDLIB);$(LIB);$(DHLIB);$(RMLIB);$(APM_LIB)] || \
    [set PATH=$(TOOLSPATH);$(DK_TOOLS)]
!endif


#
# Compiler/tools Macros
#

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

#
# Set compiler and Linker Options
#
#  To create ICAT debug version use:
#     nmake icat=on
#
#  To activate debug code that will INT 3 if there is an error when the driver returns from an IORB request:
#     nmake stop_on_iorb_error=on
#
#  To activate development BLDLEVEL identification use:
#     nmake pre_release=on
#

AFLAGS = -MX -T -Z $(ENV)
AINC   = -I. -I$(DOSINC) -I$(INIT) -I$(INC)
CFLAGS = /c /Zp /G2s /Answ /nologo $(ENV)
LFLAGS = /map /nod /exepack /packd /a:16 /far

!ifdef icat
CFLAGS = $(CFLAGS) /Zi /Od
LFLAGS = $(LFLAGS) /co
!endif

!ifdef pre_release
CFLAGS = $(CFLAGS) /DPRE_RELEASE /DBBR
!endif

!ifdef stop_on_iorb_error
CFLAGS = $(CFLAGS) /DDEBUG_STOP_ON_IORB_ERROR
!endif

DFLAGS = /c /Zp /G2s /Answ /Zdi /nologo $(ENV) /DPRE_RELEASE /DCHECK_HANDLES /DDEBUG /DDMA_DEFALUT_OFF /DARIUM_MONITOR_P54_PRO /DDEBUG_STOP_ON_IORB_ERROR
RFLAGS = -r

LIBS  =  $(DHLIB)\dhcalls.lib $(ADDLIB)\addcalls.lib $(APM_LIB)\apmcalls.lib $(LIB)\libh.lib $(RMLIB)\rmcalls.lib

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

#
# OBJ files
#
#
OBJ1 =  S506SEGS.OBJ
OBJ2 =  S506DATA.OBJ S506RTE.OBJ  S506SM.OBJ   S506IORB.OBJ S506APM.OBJ
OBJ3 =  S506TIMR.OBJ S506PS2.OBJ  S506CSUB.OBJ S506OSM2.OBJ S506OEM.OBJ
OBJ4 =  S506INIT.OBJ CMDPARSE.OBJ S506PRTF.OBJ S506OEMI.OBJ S506PIIX.OBJ
OBJ5 =  S506GEOM.OBJ S506I13.OBJ

#
# OBJ files for MCA/IDE
#
#
MBJ1 =  S506SEGS.MBJ
MBJ2 =  S506DATA.MBJ S506RTE.OBJ  S506SM.MBJ   S506IORB.OBJ S506APM.OBJ
MBJ3 =  S506TIMR.OBJ S506PS2.MBJ  S506CSUB.OBJ S506OSM2.MBJ S506OEM.OBJ
MBJ4 =  S506INIT.MBJ CMDPARSE.OBJ S506PRTF.OBJ S506OEMI.OBJ S506PIIX.OBJ
MBJ5 =  S506GEOM.OBJ S506I13.OBJ

#
# DBJ files
#
#
DBJ1 =  S506SEGS.OBJ
DBJ2 =  S506DATA.DBJ S506RTE.DBJ  S506SM.DBJ   S506IORB.DBJ S506APM.DBJ
DBJ3 =  S506TIMR.DBJ S506PS2.DBJ  S506CSUB.DBJ S506OSM2.DBJ S506OEM.DBJ
DBJ4 =  S506INIT.DBJ CMDPARSE.DBJ S506PRTF.DBJ S506OEMI.DBJ S506PIIX.DBJ
DBJ5 =  S506GEOM.DBJ S506I13.DBJ

#
#       LIST Files
#
LIST=   S506SEGS.MST S506DATA.LST S506RTE.LST  S506SM.LST   S506IORB.LST \
        S506TIMR.LST S506PS2.LST  S506CSUB.LST S506INIT.LST CMDPARSE.LST \
        S506PRTF.LST S506OSM2.LST S506OEM.LST  S506INIT.MST S506DATA.MST \
        S506OSM2.MST S506SEGS.LST S506OEMI.LST S506APM.LST  S506PIIX.LST \
        S506GEOM.LST S506I13.LST

OBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5)
MBJS = $(MBJ1) $(MBJ2) $(MBJ3) $(MBJ4) $(MBJ5)
DBJS = $(DBJ1) $(DBJ2) $(DBJ3) $(DBJ4) $(DBJ5)

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


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

.asm.mbj:
        $(AS) $(AFLAGS) -DMMIOPH -DMCA $(AINC) $*.asm $*.mbj;

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

.asm.mst:
        $(AS) -l -n $(AFLAGS) -DMCA $(AINC) $*.asm;
        copy $*.lst $*.mst

.c.obj:
        $(CC) $(CFLAGS) $(CINC) $*.c

.c.mbj:
        $(CC) $(CFLAGS) -DMCA $(CINC) -Fo$*.mbj $*.c

.c.dbj:
        $(CC) $(DFLAGS) $(CINC) -Fo$*.dbj /Fc $*.c
        copy $*.cod $*.lst
        del $*.cod

.c.lst:
        $(CC) $(CFLAGS) /Fc $(CINC) $*.c
        copy $*.cod $*.lst
        del $*.cod

.c.mst:
        $(CC) $(CFLAGS) -DMCA /Fc $(CINC) -Fo$*.mbj $*.c
        copy $*.cod $*.mst
        del $*.cod


#****************************************************************************
#   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
#

!include      "$(H)\version.mak"
!ifdef pre_release
_VENDOR  = IBM
_VERSION = 9.36
FILEVER = @^#$(_VENDOR):$(_VERSION) Private by V.Rapp 06/09/98^#@
!endif

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

all:   ibm1s506.add ibm2ide.add

debug: dbm1s506.add

list: $(LIST)

clean:
        if exist *.lnk  del *.lnk
        if exist *.obj  del *.obj
        if exist *.dbj  del *.dbj
        if exist *.mbj  del *.mbj
        if exist *.map  del *.map
        if exist *.lst  del *.lst
        if exist *.mst  del *.mst
        if exist *.lsd  del *.lsd
        if exist *.sym  del *.sym
        if exist *.add  del *.add
        if exist *.def  del *.def
        if exist *.mak  del *.mak


#*****************************************************************************
#   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.
#

ibm1s506.add:  $(OBJS) $(LIBS) makefile
        Rem Create DEF file <<$(@B).def
LIBRARY $(@B)

DESCRIPTION "$(FILEVER)  Adapter Driver for ST506/IDE DASD"

PROTMODE

SEGMENTS
 DDHeader       CLASS 'DATA'
 LIBDATA        CLASS 'DATA'
 _DATA          CLASS 'DATA'
 CONST          CLASS 'CONST'
 _BSS           CLASS 'BSS'
 'Code'         CLASS 'CODE' IOPL
 LIBCODE        CLASS 'CODE' IOPL
 _TEXT          CLASS 'CODE' IOPL
 InitCode       CLASS 'CODE' IOPL
 RMCode         CLASS 'CODE' IOPL

<<keep
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBJ1) +
$(OBJ2) +
$(OBJ3) +
$(OBJ4) +
$(OBJ5)
$*.add
$*.map
$(LIBS)
$(@B).def
<<keep
             $(MAPSYM) $*.map
########     trcust $*.tsf

ibm2ide.add:  $(MBJS) $(LIBS) makefile
        Rem Create DEF file <<$(@B).def
LIBRARY $(@B)

DESCRIPTION "$(FILEVER)  Adapter Driver for MCA/IDE DASD"

PROTMODE

SEGMENTS
 DDHeader       CLASS 'DATA'
 LIBDATA        CLASS 'DATA'
 _DATA          CLASS 'DATA'
 CONST          CLASS 'CONST'
 _BSS           CLASS 'BSS'
 'Code'         CLASS 'CODE' IOPL
 LIBCODE        CLASS 'CODE' IOPL
 _TEXT          CLASS 'CODE' IOPL
 InitCode       CLASS 'CODE' IOPL
 RMCode         CLASS 'CODE' IOPL

<<keep
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(MBJ1) +
$(MBJ2) +
$(MBJ3) +
$(MBJ4) +
$(MBJ5)
$*.add
$*.map
$(LIBS)
$(@B).def
<<keep
             $(MAPSYM) $*.map
########     trcust $*.tsf

dbm1s506.add:  $(DBJS) $(LIBS) makefile
        Rem Create DEF file <<$(@B).def
LIBRARY IBM1S506

DESCRIPTION "$(FILEVER)  Debug Adapter Driver for ST506/IDE DASD"

PROTMODE

SEGMENTS
 DDHeader       CLASS 'DATA'
 LIBDATA        CLASS 'DATA'
 _DATA          CLASS 'DATA'
 CONST          CLASS 'CONST'
 _BSS           CLASS 'BSS'
 'Code'         CLASS 'CODE' IOPL
 LIBCODE        CLASS 'CODE' IOPL
 _TEXT          CLASS 'CODE' IOPL
 InitCode       CLASS 'CODE' IOPL
 RMCode         CLASS 'CODE' IOPL
<<keep
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(DBJ1) +
$(DBJ2) +
$(DBJ3) +
$(DBJ4) +
$(DBJ5)
$*.add
$*.map
$(LIBS)
$(@B).def
<<keep
             $(MAPSYM) $*.map

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