# File: drivers/net/Makefile
#
# Makefile for the Linux network (ethercard) device drivers.
#

# This will go away in some future future: hidden configuration files
# are difficult for users to deal with.
include CONFIG

# Build MODULES by appending to this string for every driver below
MODULES :=

NETDRV_OBJS := Space.o auto_irq.o net_init.o loopback.o
override CFLAGS := $(CFLAGS) -I../../net/inet
override CPP := $(CPP) -I../../net/inet

.c.o:
	$(CC) $(CFLAGS) -c $<


# The point of the makefile...
all: net.a

Space.o: Space.c ../../include/linux/autoconf.h
	$(CC) $(CFLAGS) $(OPTS) -c $<

net_init.o: ../../include/linux/autoconf.h

auto_irq.o:

ifdef CONFIG_ARIADNE
NETDRV_OBJS := $(NETDRV_OBJS) ariadne.o
else
ifdef CONFIG_AMIGA
MODULES := $(MODULES) ariadne.o
endif
endif

ifdef CONFIG_A2065
NETDRV_OBJS := $(NETDRV_OBJS) a2065.o
else
ifdef CONFIG_AMIGA
MODULES := $(MODULES) a2065.o
endif
endif

ifdef CONFIG_HYDRA
NETDRV_OBJS := $(NETDRV_OBJS) hydra.o
else
ifdef CONFIG_AMIGA
MODULES := $(MODULES) hydra.o
endif
endif

ifdef CONFIG_ATARILANCE
NETDRV_OBJS := $(NETDRV_OBJS) atarilance.o
else
ifdef CONFIG_ATARI
MODULES := $(MODULES) atarilance.o
endif
endif

ifdef CONFIG_ATARI_BIONET
NETDRV_OBJS := $(NETDRV_OBJS) atari_bionet.o
else
# Until the ACSI driver can be built as a module it must be compiled in
ifdef CONFIG_ATARI_ACSI
MODULES := $(MODULES) atari_bionet.o
endif
endif

ifdef CONFIG_ATARI_PAMSNET
NETDRV_OBJS := $(NETDRV_OBJS) atari_pamsnet.o
else
# Until the ACSI driver can be built as a module it must be compiled in
ifdef CONFIG_ATARI_ACSI
MODULES := $(MODULES) atari_pamsnet.o
endif
endif

ifdef CONFIG_PPP
NETDRV_OBJS := $(NETDRV_OBJS) ppp.o
CONFIG_SLHC = CONFIG_SLHC
else
MODULES := $(MODULES) ppp.o
endif

ifdef CONFIG_SLIP
NETDRV_OBJS := $(NETDRV_OBJS) slip.o
CONFIG_SLHC = CONFIG_SLHC
else
MODULES := $(MODULES) slip.o
endif
slip.o:	slip.c CONFIG
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<

ifdef CONFIG_DUMMY
NETDRV_OBJS := $(NETDRV_OBJS) dummy.o
else
MODULES := $(MODULES) dummy.o
endif
dummy.o: dummy.c CONFIG
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<

ifdef CONFIG_SLHC
NETDRV_OBJS := $(NETDRV_OBJS) slhc.o
else
MODULES := slhc.o $(MODULES)
endif

net.a: $(NETDRV_OBJS)
	rm -f net.a
	$(AR) rcs net.a $(NETDRV_OBJS)

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

dep:
	$(CPP) -M $(NETDRV_OBJS:.o=.c) > .depend
ifdef MODULES
	$(CPP) -M -DMODULE $(MODULES:.o=.c) >> .depend
endif

tar:

ifdef MODULES

modules: $(MODULES)
	echo $(MODULES) > ../../modules/NET_MODULES
	cd ../../modules; \
		for i in $(MODULES); do ln -sf ../drivers/net/$$i .; done

else

modules:

endif

# include a dependency file if one exists

ifeq (.depend,$(wildcard .depend))
include .depend
endif
