#
#

CC = gcc

TRUEROOT = /usr/src/linux-2.4
WORKROOT = /usr/src/linux-2.4

INCLS = -I. -I$(WORKROOT)/include      -I$(WORKROOT)/include/asm-um

DEFS =  -D__KERNEL__  -DCPU=586
# -DDBG_RECV -DDBG_RCV -DDBG_SEND -DDBG_TIMER

OPTIONS =  -O2 -fomit-frame-pointer                \
           -fno-strength-reduce                    \
           -fvolatile                              \
           -fvolatile-global                       \
           -pipe -mcpu=i586 -falign-loops=2             \
           -falign-jumps=2 -falign-functions=2

EFLAGS =  $(INCLS) $(DEFS) $(OPTIONS)
CFLAGS =  $(EFLAGS) -c
UFLAGS =  $(INCLS) -DAPP_MODE -DGLIBC_PATCH
MFLAGS = -DMODULE -DMODVERSION $(CFLAGS)

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

MOBJECT  = ttpinit.o

SOBJECTS = ttpsend.o    \
           ttpport.o    \
           ttprecv.o    \
           ttplisten.o  \
           ttpaccept.o  \
           ttpconnect.o \
           ttpopen.o    \
           ttputil.o    \
           ttptimer.o
#           ttpsend.o  \
#           ttppops.o  \

INCLUDE = ttpdefs.h \
          ttpcomm.h

MODULE  = ttp.o

$(MODULE): $(MOBJECT)  $(SOBJECTS)
	ld -Map ttp.map -r -o $(MODULE)  $(MOBJECT) $(SOBJECTS)
#- >/var/log/messages
#	- /sbin/rmmod ttp
#	- /sbin/insmod ttp.o

$(MOBJECT): $(INCLUDE) ttpinit.c
	-rm *.err
	-$(CC) $(MFLAGS) ttpinit.c 2> ttpinit.err


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

xopen:    xopen.c
	gcc -g -o $@ -g $@.c
xsend:    xsend.c
	gcc -g -o $@ -g $@.c
xrecv:    xrecv.c
	gcc -g -o $@ -g $@.c
attpgen:  attpgen.c
	gcc -g -o $@ -g $@.c
attpgobl: attpgobl.c
	gcc -g -o $@ -g $@.c
attpsend: attpsend.c
	gcc -g -o $@ -g $@.c
attprecv: attprecv.c
	gcc -g -o $@ -g $@.c
