#
# Makefile for UNM ethernet NIC driver as part of the kernel build
#

UNM_ARCH ?= P3
ifeq ($(UNM_ARCH),P3)
P3_MODE ?= P3_NIC_CUT_THRU
endif

O_TARGET := unm_nic.o

obj-y	:= unm_nic_hw.o unm_nic_main.o unm_nic_init.o unm_nic_ethtool.o nx_nic_vmk.o \
	   nxhal.o nxhal_v34.o xge_mdio.o niu.o nx_hash_table.o nx_mem_pool.o \
           unm_nic_procfs.o unm_nic_lro.o unm_nic_tool.o
obj-m	:= $(O_TARGET)

UNMSRC := $(HPATH)/../drivers/net/unm_nic
 
EXTRA_CFLAGS += -I$(UNMSRC)/include -I.

NETXEN_DEFS ?= -D$(UNM_ARCH) -DPEGNET_NIC
ifeq ($(UNM_ARCH),P3)
NETXEN_DEFS += -D$(P3_MODE)
endif

NETXEN_DEFS += -DUNM_X_HARDWARE=UNM_X_ASIC
NETXEN_DEFS += -DUNM_CONF_PROCESSOR=UNM_CONF_X86 
NETXEN_DEFS += -DUNM_CONF_OS=UNM_CONF_LINUX
NETXEN_DEFS += -DUNM_DELAY_HW=0
NETXEN_DEFS += -DUNM_HAL_NATIVE
NETXEN_DEFS += -DESX_3X_COS

EXTRA_CFLAGS += $(NETXEN_DEFS) 
EXTRA_CFLAGS += -DEXPORT_SYMTAB
EXTRA_CFLAGS += -DOLD_KERNEL -O2

HOST_CPU=$(shell $(TC_UNAME) -p)
ifeq ($(HOST_CPU),x86_64)
EXTRA_CFLAGS += -DHOST_CPU_x86_64
endif
                                                                                                                        
ifeq ($(BUILD_PLATFORM),x86_64)
    EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone -fno-unit-at-a-time -fno-reorder-blocks
endif

include $(TOPDIR)/Rules.make
