
# Makefile for kernel/blk_drv/scsi
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#

.c.s:
	$(CC) $(CFLAGS) -S $<
.s.o:
	$(AS) -c -o $*.o $<
.c.o:
	$(CC) $(CFLAGS) -c $<

SCSI_OBJS =
SCSI_SRCS =
SCSI_MODULE_OBJS =

ifdef CONFIG_SCSI

SCSI_OBJS := hosts.o scsi.o scsi_ioctl.o constants.o
SCSI_SRCS := hosts.c scsi.c scsi_ioctl.c constants.c

ifdef CONFIG_CHR_DEV_ST
SCSI_OBJS := $(SCSI_OBJS) st.o
SCSI_SRCS := $(SCSI_SRCS) st.c
endif

ifdef CONFIG_BLK_DEV_SD
SCSI_OBJS := $(SCSI_OBJS) sd.o sd_ioctl.o
SCSI_SRCS := $(SCSI_SRCS) sd.c sd_ioctl.c
endif

ifdef CONFIG_BLK_DEV_SR
SCSI_OBJS := $(SCSI_OBJS) sr.o sr_ioctl.o
SCSI_SRCS := $(SCSI_SRCS) sr.c sr_ioctl.c
endif

ifdef CONFIG_CHR_DEV_SG
SCSI_OBJS := $(SCSI_OBJS) sg.o
SCSI_SRCS := $(SCSI_SRCS) sg.c
endif

ifdef CONFIG_SCSI_DEBUG
SCSI_SRCS := $(SCSI_SRCS) scsi_debug.c
SCSI_OBJS := $(SCSI_OBJS) scsi_debug.o
endif

ifdef CONFIG_A3000_SCSI
SCSI_OBJS := $(SCSI_OBJS) a3000.o
SCSI_SRCS := $(SCSI_SRCS) a3000.c
endif

ifdef CONFIG_A2091_SCSI
SCSI_OBJS := $(SCSI_OBJS) a2091.o
SCSI_SRCS := $(SCSI_SRCS) a2091.c
endif

ifdef CONFIG_GVP11_SCSI
SCSI_OBJS := $(SCSI_OBJS) gvp11.o
SCSI_SRCS := $(SCSI_SRCS) gvp11.c
endif

ifdef CONFIG_A3000_SCSI
SCSI_OBJS := $(SCSI_OBJS) wd33c93.o
SCSI_SRCS := $(SCSI_SRCS) wd33c93.c
else
ifdef CONFIG_A2091_SCSI
SCSI_OBJS := $(SCSI_OBJS) wd33c93.o
SCSI_SRCS := $(SCSI_SRCS) wd33c93.c
else
ifdef CONFIG_GVP11_SCSI
SCSI_OBJS := $(SCSI_OBJS) wd33c93.o
SCSI_SRCS := $(SCSI_SRCS) wd33c93.c
endif
endif
endif

ifdef CONFIG_SCSI_GENERIC_NCR5380
SCSI_OBJS := $(SCSI_OBJS) g_NCR5380.o
SCSI_SRCS := $(SCSI_SRCS) g_NCR5380.c
endif

ifdef CONFIG_ATARI_SCSI
SCSI_OBJS := $(SCSI_OBJS) atari_scsi.o
SCSI_SRCS := $(SCSI_SRCS) atari_scsi.c
endif
  
scsi.a: $(SCSI_OBJS)
	rm -f scsi.a
	$(AR) rcs scsi.a $(SCSI_OBJS)
	sync

modules: $(SCSI_MODULE_OBJS)
	echo $(SCSI_MODULE_OBJS) > ../../modules/SCSI_MODULES
ifdef SCSI_MODULE_OBJS
	(cd ../../modules;for i in $(SCSI_MODULE_OBJS); do ln -sf ../drivers/scsi/$$i .; done)
endif

dep:
	$(CPP) -M $(AHA152X) $(SCSI_SRCS) > .depend
ifdef SCSI_MODULE_OBJS
	$(CPP) -M -DMODULE $(SCSI_MODULE_OBJS:.o=.c) >> .depend
endif

else

scsi.a:
	rm -f scsi.a
	@echo No SCSI drivers configured
	$(AR) rcs scsi.a

modules:

dep:

endif

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
