#/*******************************************************************************
#  Copyright (c) 2003-2004, Intel Corporation
#  All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License version 2 as published
#  by the Free Software Foundation. Alternatively, this software may be
#  distributed under the terms of the BSD license. Please see the accompanied
#  file COPYING for copyright licensing terms.
#*******************************************************************************/
# Intel GD31244 PCIX SATA HBA driver Makefile


CONFIG_GD31244=m

# obj is set iff this file is invoked by the kernel build system.
ifeq ($(obj), )
	obj := ./
endif

EXTRA_CFLAGS += -I$(obj)/drv -I$(obj)/lbr -Idrivers/scsi

include $(obj)/include.mak

gd31244_lib-objs := lbr/sata_adapter.o \
		    lbr/sata_controller.o \
		    lbr/sata_device.o \
		    lbr/sata_globals.o \
		    lbr/sata_debug.o \
		    lbr/sata_lib.o \
		    lbr/OSL_linux.o \
                    lbr/sata_port.o 
		    
gd31244_drv-objs := drv/gd31244_satascsi.o \
		    drv/gd31244_lld.o
		    
ifneq ($(KERNELRELEASE), )

# invoked by the Kernel build system.
obj-$(CONFIG_GD31244)   += gd31244.o
gd31244-objs            := $(gd31244_lib-objs) $(gd31244_drv-objs)

else
# invoked outside the kernel build system.
KDIR	:= /lib/modules/$(shell uname -r)/build
PWD	:= $(shell pwd)
default:
	@echo Building $@ outside the kernel build system for kernel `uname -r`
	$(MAKE) -C $(KDIR) CONFIG_GD31244=m SUBDIRS=$(PWD) modules	

mod:
	@echo Building $@ outside the kernel build system for $(KSRC)
	@echo $(MAKE)
	$(MAKE) -C $(KSRC) CONFIG_GD31244=m SUBDIRS=$(PWD) modules	
endif

clean:
	@find $(PWD) \
		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
		-type f -print | xargs rm -f
