#
# Makefile for the Linix TCP/IP (INET) layer.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definition is now in the main makefile...

.c.o:
	$(CC) $(CFLAGS) \
	-c -o $*.o $<
.s.o:
	$(AS) -o $*.o $<
.c.s:
	$(CC) $(CFLAGS) \
	-S -o $*.s $<


OBJS	= Space.o sock.o utils.o route.o proc.o timer.o protocol.o loopback.o \
	  eth.o packet.o arp.o dev.o we.o 8390.o wd.o ne.o el.o hp.o plip.o \
	  slip.o auto_irq.o ip.o raw.o icmp.o tcp.o udp.o


inet.o:		$(OBJS)
		$(LD) -r -o inet.o $(OBJS)

# Set the address and IRQ here. The ne.c and 3c503 driver will autoprobe
# if you set the address or IRQ to zero, so we do that by default.
# Cards supportted:
#
#	WE8003		The old "we" dcriver for WD80x3
#	WD8003		The Western Digital (SMC) WD80x3 driver
#	  WD_SHMEM=xxx	Forces the address of the shared memory
#	  FORCE_8BIT	Force card into 8-bit mode (WD8003)
#	NE2000		The Novell NE-2000 driver
#	  EI_8BIT	Forces the card into 8-bit mode (NE-1000)
#	HPLAN		The HP-LAN driver
#	EL1		The 3c501 EtherLink I driver (source missing?)
#	EL2		The 3c503 EtherLink II driver
#	  EL2_AUI	Selects the AUI port instead of the BNC port
#	PLIP		The Crynwe PL/IP driver
#	SLIP		The MicroWalt SLIP driver
#	  SL_DUMP	Uses the "dump frame" debug code
#
#OPTS	      := -DEI8390=0 -DEI8390_IRQ=0
OPTS	      := -DEI8390=0x280 -DEI8390_IRQ=15
CARDS	      := -DSLIP -DWD8003 -DPLIP -DNE2000 -DHPLAN -DEL2
WD_OPTS	      := -DWD_SHMEM=0xCC000 -UFORCE_8BIT
EL_OPTS	      := -UEL2_AUI
NE_OPTS	      := -UEI_8BIT
HP_OPTS	      :=
PLIP_OPTS     :=
SLIP_OPTS     := -DSL_DUMP
PROC_OPTS     := -DHUMAN_READABLE

Space.o:	Space.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTS) $(CARDS) -c Space.c -o $@

we.o:		we.c wereg.h Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(WE_OPTS) -c we.c -o $@

8390.o:		8390.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(CARDS) -c 8390.c -o $@

wd.o:		wd.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c wd.c -o $@

el.o:		el.c elreg.h Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) -UEL2_AUI -c el.c -o $@

ne.o:		ne.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c ne.c -o $@

hp.o:		hp.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c hp.c -o $@

plip.o:		plip.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c plip.c -o $@

slip.o:		slip.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(SLIP_OPTS) -c slip.c -o $@

route.o:	route.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) -c route.c -o $@

proc.o:		proc.c Makefile
		$(CC) $(CPPFLAGS) $(CFLAGS) $(PROC_OPTS) -c proc.c -o $@

subdirs:	dummy
		for i in $(SUBDIRS); do (cd $$i; $(MAKE)); done


clean:
		rm -f core *.o *.a *.s

dep:
		$(CPP) -M *.c > .depend

tar:
		tar -cvf /dev/f1 .

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
