#
# Makefile for linux Interphase 5515 Device driver.
#   This version builds the FULL STACK DRIVER ...
#

CC = gcc

TRUEROOT = /usr/src/linux
WORKROOT = /usr/src/linux

INCLS = -I$(WORKROOT)/net/atm  -I$(WORKROOT)/include

# If you are building for an SMP kernel you MUST include -D__SMP__
# If you are building for a non-SMP kernel you must NOT include it.

DEFS =  -D__KERNEL__ -D__SMP__ -DCPU=586

# DEFS =  -D__KERNEL__ -D__SMP__ -DCPU=586 -DDEBUG_BASE -DDBG_RECV -DDB_XMIT

OPTIONS =  -O2 -fomit-frame-pointer                \
           -fno-strength-reduce                    \
           -fvolatile                              \
           -fvolatile-global                       \
           -pipe -m486 -malign-loops=2             \
           -malign-jumps=2 -malign-functions=2

EFLAGS =  $(INCLS) $(DEFS) $(OPTIONS)
CFLAGS =  $(EFLAGS) -c
UFLAGS =  $(INCLS) -g -DAPP_MODE -DGLIBC_PATCH -L/usr/src/atm/lib
MFLAGS = -DMODULE -DMODVERSION $(CFLAGS)

# This section makes the driver.. It assumes that the kernel
# has been configured to support MODULES and MODVERSIONS

MOBJECT  = ia_flip.o

SOBJECTS = ia_pci.o ia_eeprom.o ia_ffred.o ia_rfred.o ia_suni.o \
           ia_ioctl.o  ia_lnxatm.o

INCLUDE =  ia.h       ia_conf.h  ia_dbg.h   ia_flip.h  \
           ia_types.h  ia_comm.h ia_cs.h    ia_defs.h  ia_fred.h \
           ia_suni.h

MODULE  = ia.o

$(MODULE): $(MOBJECT) $(SOBJECTS) $(INCLUDE)
	ld -Map atm.map -r -o $(MODULE)  $(MOBJECT) $(SOBJECTS)

$(MOBJECT): $(INCLUDE) ia_flip.c
	$(CC) $(MFLAGS) ia_flip.c 2> ia_flip.err

$(SOBJECTS): $(INCLUDE)
.c.o: $<
	$(CC) $(CFLAGS) $<  2> $(@:.o=.err)


IADS = iad_flip iad_suni iad_ffrd iad_rfrd  iad_dumprx iad_dstx iad_settxp \
       iad_txb

${IADS}:
	$(CC) $(UFLAGS) -o $@ $(INCLS) $@.c 2> $@.err

iads:
	make $(IADS)

IATS = iat_send iat_recv iat_dsig
${IATS}:
	$(CC) $(UFLAGS) -o $@ $(INCLS) $@.c 2> $@.err

iats:
	make $(IATS)

# These test the ATM Linux native protocol stack over PVC's

AAS      = aasock aaconn aasend aarecv   \
           aatxrx aagen  aagengob aagobl \
           aarun

${AAS}:
	$(CC) $(UFLAGS) -o $@ $(INCLS) $@.c 2> $@.err

aas:
	make $(AAS)

