#******************************************************************************
#  Makefile for the IBM2SCSI directory
#
#	SCCSID = @(#)makefile	6.6 92/02/06
#
#	IBM Confidential
#
#	Copyright (c) IBM Corporation 1987, 1989
#
#	All Rights Reserved
#
#******************************************************************************

#
#	makefile for OS/2 2.0 SCSI ADD
#
#	You can optionally generate the listing files for the device driver.
#
#	   make  [option]
#
#	     option:	 list	      -> create listings
#			 ibm2scsi.add -> create PS/2 386 RETAIL driver
#			 debugi       -> create debug version w/informational
#					 messages
#			 debug	      -> create debug version w/only error
#					 messages
#
#	     default:  create ibm2scsi.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 .sys .exe .obj .mbj .asm .inc .def .lnk .lrf .crf .ref
.SUFFIXES: .lst .sym .map .c .h .lib .dbj .ibj .cod .add

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

#
# Conditional Setup Area and User Defined Macros
#

#
# Compiler Location w/ includes, libs and tools (for OS/2 build system)
#

H      = ..\..\..\..\..\h
LIB    = ..\..\..\..\..\lib
TOOLSPATH = ..\..\..\..\..\tools
DISKH  = ..\..\diskh
DELIVH = ..\delivery
DHLIB  = ..\..\devhelp
LIBOBJ = ..\..\libobj


#
# Compiler Location w/ includes, libs and tools (for ESW build system)
#

# H	 = ..\h
# LIB	 = ..\lib
# TOOLSPATH = ..\tools
# DISKH  = ..\diskh
# DELIVH = ..\delivery
# DHLIB  = ..\devhelp
# LIBOBJ = ..\libobj

#
# 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)] || \
   [set LIB=$(LIB);$(DHLIB)] || [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
#
# Comment out DFLAGS to get rid of debug stuff.
#

AFLAGS	= -MX -T -Z $(ENV)
DFLAGS	= -DDEBUG -DINFORM
AINC	= -I.
CINC	= -I. -I$(H) -I$(DISKH) -I$(MAKEDIR) -I$(DELIVH)
CFLAGS	= /c /Zp /G2s /Answ $(ENV)
CDFLAGS = /c /Zp /Od /G2s /Answ /Fc$*.dod $(ENV) -DDEBUG -DINFORM
LFLAGS	= /map /nod /exepack /packd /a:16 /far /noe

LIBS  =  $(DHLIB)\dhcalls.lib $(LIB)\libh.lib
PCLIBS	=  $(LIB)\SLIBCEP.LIB $(LIB)\OS2286.LIB


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

#
#
#

LIBOBJS =

OBJS =	scsisegs.obj scsidata.obj scsistr1.obj scsisubs.obj scsisub2.obj \
	scsireq1.obj scsireq2.obj scsireq3.obj scsiint.obj io.obj \
	$(LIBOBJ)\anuldiv.obj $(LIBOBJ)\anlmul.obj scsitimr.obj \
	scsiinit.obj sprntf.obj


DOBJS = scsisegs.obj scsidata.dbj scsistr1.dbj scsisubs.dbj scsisub2.dbj \
	scsireq1.dbj scsireq2.dbj scsireq3.dbj scsiint.dbj io.obj \
	$(LIBOBJ)\anuldiv.obj $(LIBOBJ)\anlmul.obj scsitimr.dbj \
	dprintf.obj scsiinit.dbj sprntf.obj

PCOBJS = ibm2scpr.obj

#
#	LIST Files
#
LIST=	scsisegs.lst scsidata.lst scsistr1.lst scsisubs.lst scsisub2.lst \
	scsireq1.lst scsireq2.lst scsireq3.lst scsiint.lst  \
	scsitimr.lst scsiinit.lst sprntf.lst

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


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

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

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

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

.c.dbj:
	$(CC) $(CDFLAGS) /Fo$*.dbj $(CINC) $*.c

.c.lst:
	$(CC) $(CFLAGS) /Fc $(CINC) $*.c
	copy $*.cod $*.lst
	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
#


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

all:   ibm2scsi.add ibm2scpr.exe

list: $(LIST)

clean:
	if exist *.lnk	del *.lnk
	if exist *.obj	del *.obj
	if exist *.dbj	del *.dbj
	if exist *.map	del *.map
	if exist *.lst	del *.lst
	if exist *.sym	del *.sym
	if exist *.add	del *.add
	if exist *.dod	del *.dod
	if exist *.cod	del *.cod


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

ibm2scsi.add:  $(OBJS) $(LIBS) makefile
	Rem Create DEF file <<ibm2scsi.def
LIBRARY IBM2SCSI
DESCRIPTION "$(FILEVER)  Adapter Driver for SCB Devices (non ABIOS)"
PROTMODE
CODE	PRELOAD
DATA	PRELOAD
<<keep
	$(LINK) @<<ibm2scsi.lnk
$(OBJS)
ibm2scsi.add
ibm2scsi.map $(LFLAGS)
$(LIBS)
ibm2scsi.def
<<keep
	$(MAPSYM) $*.map

debug:	dbg2scsi.add

dbg2scsi.add: $(DOBJS) $(LIBS) makefile
	Rem Create DEF file <<ibm2scsi.def
LIBRARY IBM2SCSI
DESCRIPTION "$(FILEVER)  Adapter Driver for SCB Devices (non ABIOS)"
PROTMODE
CODE	PRELOAD
DATA	PRELOAD
<<keep
	$(LINK) @<<debug.lnk
$(DOBJS)
dbg2scsi.add
dbg2scsi.map $(LFLAGS)
$(LIBS)
ibm2scsi.def
<<keep
	$(MAPSYM) $*.map


ibm2scpr.exe: $(PCOBJS) makefile
	Rem Create DEF file <<$*.def
NAME IBM2SCPR WINDOWCOMPAT
DESCRIPTION "$(FILEVER)  IBM2SCSI - Presence Detection Module"
PROTMODE
<<keep
	$(LINK) @<<$*.lnk
$(PCOBJS)
$*.exe
$*.map $(LFLAGS)
$(PCLIBS)
$*.def
<<keep
	$(MAPSYM) $*.map



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