# Makefile - Copyright Steve Woodford, August 1993.
#
# Ensure the current directory contains 2 sub-directories:
# One called 'o' and one called '3o', to contain the object files.
#
# Modify the following to select which library to build: -mshort, or normal
# SZ is '32' for long integers, '16' for short integers. Remember 'IL' too.
# (Filename length may be a problem on a plain TOS filesystem.)
#
SZ= 32
IL=
#
#SZ= 16
#IL= -mshort

# Specify the name of the library to build. You may need to change this
# if building for Gcc version 2. I developed this using v1.39, so my
# libraries follow the old naming rules...
LIBNAME=	libscsi$(SZ).a

# At the moment, only Gnu C will be able to compile this library.
CC= gcc
CFLAGS= -O2 -fomit-frame-pointer -fstrength-reduce $(IL)
AR= ar
ARMODE= s

D=$(SZ)o
HDR=libscsi.h

OBJS= $(D)/scsi_io.o $(D)/scsicmd.o $(D)/test_rdy.o $(D)/rezero.o \
	$(D)/req_sens.o $(D)/rw_seq.o $(D)/rw_rand.o $(D)/seek_seq.o \
	$(D)/seek_rnd.o $(D)/filemark.o $(D)/space.o $(D)/inquire.o \
	$(D)/erase.o $(D)/mod_sens.o $(D)/load.o $(D)/prevent.o \
	$(D)/timeout.o $(D)/to.o $(D)/cfile.o

all:	$(LIBNAME)

clean:
	rm -rf 16o/* 32o/* core

realclean:	clean
	rm -rf *.a

$(LIBNAME):	$(OBJS)
	$(AR) $(ARMODE) $(LIBNAME) $(OBJS)

$(D)/scsi_io.o:	scsi_io.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/scsicmd.o:	scsicmd.cpp
	$(CC) $(IL) -P -x assembler-with-cpp -c $< -c -o $@

$(D)/test_rdy.o:	test_rdy.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/rezero.o:	rezero.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/req_sens.o:	req_sens.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/rw_seq.o:	rw_seq.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/rw_rand.o:	rw_rand.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/seek_seq.o:	seek_seq.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/seek_rnd.o:	seek_rnd.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/filemark.o:	filemark.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/space.o:	space.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/inquire.o:	inquire.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/erase.o:	erase.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/mod_sens.o:	mod_sens.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/load.o:	load.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/prevent.o:	prevent.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/timeout.o:	timeout.c $(HDR)
	$(CC) $(CFLAGS) $< -c -o $@

$(D)/to.o:	to.c $(HDR)
	$(CC) $< -c -o $@

$(D)/cfile.o:	cfile.c cfile.h
	$(CC) $(CFLAGS) $< -c -o $@

