#
# Makefile for tc902x.c
#
# Craig Rich
# Sundance Technology, Inc.
# 1485 Saratoga Avenue
# Suite 200
# San Jose, CA 95129
# 408 873 4117
# www.sundanceti.com
# craig_rich@sundanceti.com
#
# Rev  Date     Description
# --------------------------------------------------------
# 0.1  11/8/99  Initial revision
# 0.2  12/1/99  Corrections and added MODVERSYM variable
# 0.3  2/7/01   Changed all "st2021" refs to "tc902x"
# 0.4  3/26/01  Changed "-O6" compiler option to "-O2"
# 0.5  8/13/01  Add TC902X_STI_FIBER_DETECT and
#               TC902X_TMI_FIBER_DETECT
#
# Usage: In directory containing this Makefile, and
#        tc902x.c file, execute the following:
#
#        make all
#

#
# Enable/disable debug messages.
#
DEBUG = N

ifeq ($(DEBUG),Y)
	DEBUGFLAGS = -g -DTC902X_DEBUG
else
	DEBUGFLAGS =
endif

INC_DIR := /usr/src/linux-$(shell uname -r)/include
INCLUDE := -I $(INC_DIR)

#
# Define MODVERSIONS symbol if needed.
#
ifeq ($(wildcard $(INC_DIR)/linux/modversions.h),$(INC_DIR)/linux/modversions.h)
        MODVERSYM = -DMODVERSIONS -include $(INC_DIR)/linux/modversions.h
else
        MODVERSYM =
endif

#
# Define compile.
#	gcc the traditinal compiler
#   kgcc the new kernel compiler
#
CC = gcc

# Define USE_IO_OPS for I/O operations only (not memory).
# Define TC902X_STI_FIBER_DETECT or TC902X_TMI_FIBER_DETECT to
# select method for detecting fiber based NICs.
#OTHER = -DUSE_IO_OPS
#OTHER = -DTC902X_STI_FIBER_DETECT
#OTHER = -DTC902X_TMI_FIBER_DETECT
OTHER = -DTC902X_TMI_FIBER_DETECT

#
# Compiler flags:
#
# -DMODULE	defines the 'MODULE" symbol. 
#
# -D__KERNEL__	defines the '__KERNEL__' symbol used for masking
#		out unneeded portions of kernel headers.
#
# -O2		specifies compiler optimization to provide for
#		expansion of functions by gcc.
#
# -Wall		specifies all compiler warnings should be indicated.
#
# -Wstrict-prototypes	specifies compiler warnings should be indicated
#		        for functions defined or declared without
#		        argument types.
#
#		
CFLAGS = -DMODULE -D__KERNEL__ $(MODVERSYM) $(INCLUDE) -O2 -Wall -Wstrict-prototypes $(DEBUGFLAGS) $(OTHER) 

#
# Dependencies to create object file.
#
all:	tc902x.o

tc902x.o: tc902x.c
	gcc $(CFLAGS) -c tc902x.c -o tc902x.o

#
# Delete existing object files.
#
clean:
	rm -f *.o
