#	START NEW ARIX SCCS HEADER
#
#	@(#) makefile: version 25.1 created on 11/27/91 at 14:44:30
#
#	Copyright (c) 1990 by Arix Corporation
#	All Rights Reserved
#
#	@(#)makefile	25.1	11/27/91 Copyright (c) 1990 by Arix Corporation
#
#	END NEW ARIX SCCS HEADER
#

# IROOT is provided by the driving makefile or script OR
# for stand alone makes, PWD provide as a command line varible or
# environment varible (ksh).

IROOT   = $(PWD)/..
SHELL   = /bin/sh
include $(IROOT)/macdefs

# Local defaults.
# To turn off asserts, set DEBUGOPT="" and DEBUGDIR=NDBG

MACH = M68040
UMACH = M68020
DEBUGDIR = DBG
DEBUGOPT = -DASDEBUG=YES

# The flags definitions for scsi driver
#
# SCSI_LOG : Include all the log statements.
#
# INITIATOR_ID: setup a scsi bus id to scsi controller. the value is range
#		from 0 - 7. Without setting this variable, the controller
#		bus id  will be default to 0. When this variable is modified,
#		the file 'dsdb/scsi_linit.c' has to be recompiled.
# BUS_TIMER_DEBUG: Includes debug code for bus timeout.
# ATT:	AT&T sorting algorithm.

LOCAL_CFLAGS = -T3 -I$(IOPMINC) -I../head -DIOPM $(DEBUGOPT) \
		-DINITIATOR_ID=7 -DATT

DISK = \
	disk/sdk_intr.o \
	disk/sdk_ioctl.o \
	disk/sdk_open.o \
	disk/sdk_strat.o

OPTICAL = \
	opt/opt_intr.o \
	opt/opt_ioctl.o \
	opt/opt_open.o \
	opt/opt_strat.o

QITAPE = \
	tape/stp_intr.o \
	tape/stp_ioctl.o \
	tape/stp_open.o \
	tape/stp_strat.o

9T_TAPE = \
	tape/s9t_intr.o \
	tape/s9t_ioctl.o \
	tape/s9t_open.o \
	tape/s9t_strat.o

EXAB_TAPE = \
	tape/sxb_intr.o \
	tape/sxb_ioctl.o \
	tape/sxb_open.o \
	tape/sxb_strat.o

CDROM = \
	cdrom/cdr_open.o \
	cdrom/cdr_intr.o \
	cdrom/cdr_ioctl.o \
	cdrom/cdr_scsier.o

PASS_THRU = passthru/pt.o

SAR = sar/sar.o

COMMON = \
	common/scsi_log.o \
	dsdb/dev_que.o \
	dsdb/scsi_dbint.o \
	dsdb/scsi_lcmd.o \
	dsdb/scsi_ldma.o \
	dsdb/scsi_ldrv.o \
	dsdb/scsi_lemsg.o \
	dsdb/scsi_lfsm.o \
	dsdb/scsi_linit.o \
	dsdb/scsi_lintr.o \
	dsdb/scsi_lque.o \
	dsdb/scsi_lsend.o \
	dsdb/scsi_ltime.o \
	dsdb/scsi_iotim.o

DRIVERS = \
	$(DISK) \
	$(OPTICAL) \
	$(QITAPE) \
	$(9T_TAPE) \
	$(EXAB_TAPE) \
	$(CDROM) \
	$(PASS_THRU) \
	$(SAR) \
	$(COMMON)

# CHG_DRIVERS is the list of drivers which can change. 
# in general, this is the same as DRIVERS above, but in the case of imix, it
# is just the optical drivers
# IMIX folks need to comment out the next line and uncomment the one after.
CHG_DRIVERS = $(DRIVERS)
# CHG_DRIVERS = $(OPTICAL)

RELDIRS	= M68020/NDBG M68020/DBG M68040/NDBG M68040/DBG

default: iopm.dsdb
	$(PM)/makemap iopm.dsdb &

all: $(RELDIRS)
	@echo --- Now making 68040 nonASSERTed iopm.dsdb ---
	$(MAKE) CHG_DRIVERS="$(CHG_DRIVERS)" clean 
	$(MAKE) MACH=M68040 UMACH=M68020 DEBUGOPT="" DEBUGDIR=NDBG  \
		CHG_DRIVERS="$(CHG_DRIVERS)" iopm.dsdb
	cp iopm.dsdb M68040/NDBG

	@echo --- Now making 68020 nonASSERTed iopm.dsdb ---
	# none of the dsdb binaries depend on M68040 or M68020 so save them
	# Some optical routines require mapping to main memory, which is
	# machine dependent.
	/bin/rm -f opt/opt_intr.o
	/bin/rm -rf iopm.dsdb
	$(MAKE) MACH=M68020 UMACH=M68040 DEBUGOPT="" DEBUGDIR=NDBG \
		CHG_DRIVERS="$(CHG_DRIVERS)" iopm.dsdb
	cp iopm.dsdb M68020/NDBG

	@echo --- Now making 68040 ASSERTed iopm.dsdb ---
	$(MAKE) CHG_DRIVERS="$(CHG_DRIVERS)" clean
	$(MAKE) MACH=M68040 UMACH=M68020 DEBUGOPT=-DASDEBUG=YES DEBUGDIR=DBG \
		CHG_DRIVERS="$(CHG_DRIVERS)" iopm.dsdb
	cp iopm.dsdb M68040/DBG

	@echo --- Now making 68020 ASSERTed iopm.dsdb ---
	/bin/rm -f opt/opt_intr.o
	/bin/rm iopm.dsdb
	$(MAKE) MACH=M68020 UMACH=M68040 DEBUGOPT=-DASDEBUG=YES DEBUGDIR=DBG \
		CHG_DRIVERS="$(CHG_DRIVERS)" iopm.dsdb
	cp iopm.dsdb M68020/DBG

iopm.dsdb: $(IOPM)/iifile $(IOPM)/$(MACH)/$(DEBUGDIR)/iopm.o space.o $(CHG_DRIVERS)
	$(LD) -o iopm.dsdb $(IOPM)/iifile $(IOPM)/$(MACH)/$(DEBUGDIR)/iopm.o \
		space.o $(DRIVERS)
	if [ $(MACH) = M68040 ]; \
	then \
		$(PM)/cf/chmagic iopm.dsdb 0523; \
	fi;

clobber:	clean
	rm -f M68020/*/* M68040/*/*

clean:
	rm -f iopm.dsdb iopm.map space.o $(CHG_DRIVERS)

$(RELDIRS):
	mkdir $@

space.o:	space.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/callo.h \
	$(PMINC)/sys/stream.h \
	$(PMINC)/sys/fs/s5param.h \
	iopmconf.h \
	$(IOPMINC)/sys/buf.h \
	$(IOPMINC)/sys/tcb.h
	$(CC) -T3 -I$(IOPMINC)/sys -YI,$(PMINC) -DIOPM -O -c space.c

.c.o:
	cd $(<D); exec $(CC) $(CFLAGS) -c $(<F)

.c.s:
	cd $(<D); exec $(CC) $(CFLAGS) -S $(<F)


################## DEPENDENCY FILES of SCSI###############################

errors/scsi_log.o: \
	errors/scsi_log.c \
	$(PMINC)/sys/types.h

disk/sdk_intr.o:  \
	disk/sdk_intr.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/cdb.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	disk/sdk_cdb.h \
	disk/sdkioctl.h \
	disk/sdkcfg.h \
	disk/sdk.h

disk/sdk_ioctl.o:  \
	disk/sdk_ioctl.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
        head/hlvl_macro.h \
	head/cdb.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	disk/sdk_cdb.h \
	disk/sdkioctl.h \
	disk/sdkcfg.h \
	disk/sdk.h \
	disk/sdk_disk.h

disk/sdk_open.o: \
	disk/sdk_open.c \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/hlvl_macro.h \
	head/scsi_cmdbx.h \
	head/cdb.h \
	head/scsi_log.h \
	disk/sdk_cdb.h \
	disk/sdkioctl.h \
	disk/sdkcfg.h \
	disk/sdk.h \
	disk/sdk_disk.h

disk/sdk_strat.o: \
	disk/sdk_strat.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(IOPMINC)/sys/buf.h \
	head/hlvl_macro.h \
	head/cdb.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	disk/sdk_cdb.h \
	disk/sdkioctl.h \
	disk/sdkcfg.h \
	disk/sdk.h

dsdb/scsi_lcmd.o: \
	dsdb/scsi_lcmd.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h

dsdb/scsi_ldma.o: \
	dsdb/scsi_ldma.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_cmdbx.h \
	head/scsi_error.h \
	head/scsi_log.h \
	dsdb/scsi_db.h \
	dsdb/scsi_ncr.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_msgs.h \
	dsdb/llvl_macro.h

dsdb/scsi_ldrv.o: \
	dsdb/scsi_ldrv.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_cmdbx.h \
	head/scsi_error.h \
	head/scsi_log.h \
	dsdb/scsi_ncr.h \
	dsdb/scsi_db.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_msgs.h \
	dsdb/llvl_macro.h

dsdb/scsi_lfsm.o: \
	dsdb/scsi_lfsm.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_cmdbx.h \
	head/scsi_error.h \
	head/scsi_log.h \
	dsdb/llvl_msgs.h \
	dsdb/scsi_ncr.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_macro.h

dsdb/scsi_linit.o: \
	dsdb/scsi_linit.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	dsdb/scsi_ncr.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_msgs.h \
	dsdb/llvl_macro.h \
	dsdb/scsi_db.h

dsdb/scsi_lintr.o: \
	dsdb/scsi_lintr.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	dsdb/llvl_msgs.h \
	dsdb/scsi_ncr.h \
	dsdb/scsi_db.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_macro.h

dsdb/scsi_lque.o: \
	dsdb/scsi_lque.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	dsdb/llvl_queue.h

dsdb/scsi_lsend.o: \
	dsdb/scsi_lsend.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	dsdb/scsi_ncr.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	dsdb/llvl_msgs.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_macro.h

dsdb/scsi_ltime.o: \
	dsdb/scsi_ltime.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	dsdb/scsi_db.h \
	dsdb/scsi_ncr.h \
	dsdb/llvl_msgs.h \
	dsdb/llvl_queue.h \
	dsdb/llvl_drv.h \
	dsdb/llvl_macro.h

dsdb/scsi_lemsg.o: dsdb/scsi_lemsg.c \
		     head/scsi_error.h

dsdb/scsi_iotim.o: dsdb/scsi_iotim.c

dsdb/scsi_dbint.o:  dsdb/scsi_dbint.s

tape/stp_intr.o: \
	tape/stp_intr.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_cmdbx.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp.h \
	tape/stp_cdb.h

tape/stp_ioctl.o: \
	tape/stp_ioctl.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp.h \
	tape/stp_cdb.h \
	tape/stioctl.h

tape/stp_open.o: \
	tape/stp_open.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/buf.h \
	$(IOPMINC)/sys/user.h \
	head/cdb.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	tape/stp.h \
	tape/stp_cdb.h \
	tape/stioctl.h

tape/stp_strat.o:  \
	tape/stp_strat.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp.h \
	tape/stp_cdb.h \
	tape/stioctl.h

tape/s9t_intr.o: \
	tape/stp_intr.c \
	tape/s9t_intr.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_cmdbx.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp.h \
	tape/stp_cdb.h

tape/s9t_ioctl.o: \
	tape/stp_ioctl.c \
	tape/s9t_ioctl.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp.h \
	tape/stp_cdb.h \
	tape/stioctl.h

tape/s9t_open.o: \
	tape/stp_open.c \
	tape/s9t_open.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/buf.h \
	$(IOPMINC)/sys/user.h \
	head/cdb.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	tape/stp.h \
	tape/stp_cdb.h \
	tape/stioctl.h

tape/s9t_strat.o:  \
	tape/s9t_strat.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp.h \
	tape/stp_cdb.h 

tape/sxb_intr.o: \
	tape/sxb_intr.c \
	tape/stp_intr.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_error.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	head/cdb.h \
	tape/stp_cdb.h \
	tape/xbyte_cdb.h \
	tape/xbyte.h

tape/sxb_ioctl.o: \
	tape/stp_ioctl.c \
	tape/sxb_ioctl.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_log.h \
	head/scsi_cmdbx.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/cdb.h \
	tape/stp_cdb.h \
	tape/stioctl.h \
	tape/xbyte_cdb.h \
	tape/xbyte.h

tape/sxb_open.o: \
	tape/sxb_open.c \
	tape/stp_open.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/buf.h \
	$(IOPMINC)/sys/user.h \
	head/cdb.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	head/scsi_log.h \
	tape/stp_cdb.h \
	tape/stioctl.h \
	tape/xbyte_cdb.h \
	tape/xbyte.h

tape/sxb_strat.o:  \
	tape/sxb_strat.c \
	tape/stp_strat.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/hlvl_macro.h \
	head/cdb.h \
	head/scsi_cmdbx.h \
	head/scsi_log.h \
	tape/stp_cdb.h \
	tape/stioctl.h \
	tape/xbyte.h \
	tape/xbyte_cdb.h

opt/opt_intr.o: \
	opt/opt_intr.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/debug.h \
	$(IOPMINC)/sys/buf.h \
	$(PMINC)/sys/immu.h \
	head/scsi_log.h \
	head/scsi_error.h \
	head/hlvl_macro.h \
	opt/opt_cdb.h \
	head/scsi_cmdbx.h \
	opt/opt.h

opt/opt_ioctl.o: \
	opt/opt_ioctl.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/debug.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_log.h \
	head/hlvl_macro.h \
	opt/opt_cdb.h \
	head/scsi_cmdbx.h \
	opt/opt.h

opt/opt_open.o: \
	opt/opt_open.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/debug.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/open.h \
	$(IOPMINC)/sys/user.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_log.h \
	head/hlvl_macro.h \
	opt/opt_cdb.h \
	head/scsi_cmdbx.h \
	opt/opt.h

opt/opt_strat.o: \
	opt/opt_strat.c \
	$(PMINC)/sys/types.h \
	$(PMINC)/sys/param.h \
	$(PMINC)/sys/sysmacros.h \
	$(PMINC)/sys/errno.h \
	$(PMINC)/sys/elog.h \
	$(PMINC)/sys/file.h \
	$(PMINC)/sys/debug.h \
	$(IOPMINC)/sys/buf.h \
	head/scsi_log.h \
	head/hlvl_macro.h \
	opt/opt_cdb.h \
	head/scsi_cmdbx.h \
	opt/opt.h
