#!/usr/bin/make all # Makefile for building updated Linux PCI network device drivers as modules. # $id$ # PREFIX may be set by the RPM build to set the effective root. PREFIX= PCMCIA=/usr/src/pcmcia/include CC=gcc CFLAGS=-DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -I$(LINUX)/include -include /usr/src/linux/include/linux/modversions.h ifeq ($(KERNVER),) LINUX=/usr/src/linux KERNVER=$(shell uname -r) else LINUX=/usr/src/linux-$(KERNVER) endif MODULEDIR=$(PREFIX)/lib/modules/$(KERNVER) # Some architectures require magic gcc flags for kernel compiles. # First canoicalize the name: *86 becomes i386. ARCH:=$(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) ifeq ($(ARCH),i386) CFLAGS+=-pipe -fno-strength-reduce endif ifeq ($(ARCH),alpha) CFLAGS+=-pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 endif # Work around Red Hat 7.0 lossage. ifneq ($(wildcard /usr/bin/kgcc),) CC=kgcc endif # If the modversion.h file exists we should pass a flag. # Most of my drivers have been updated to not need this, but not the other # kernel source files. MODVER_H = $(LINUX)/include/linux/modversions.h ifneq ($(wildcard $(MODVER_H)),"") CFLAGS += -DMODVERSIONS endif #DRV_OFILES = 3c59x.o eepro100.o epic100.o hamachi.o intel-gige.o \ # myson803.o natsemi.o ns820.o rtl8139.o starfire.o \ # sundance.o tulip.o via-rhine.o winbond-840.o yellowfin.o DRV_OFILES = rtl8139.o # We can only build the ne2k-pci. driver if we have a 8390.h file available. ifneq (,$(filter 2.4.%, $(KERNVER))) # This is a 2.4 kernel, do not build ne2k-pci.o else # This is a 2.2 or earlier kernel, check that we have 8390.h ifneq (,$(wildcard $(LINUX)/drivers/net/8390.h)) DRV_OFILES += ne2k-pci.o endif endif OFILES= $(DRV_OFILES) pci-scan.o ifeq ($(wildcard $(PCMCIA)/pcmcia/driver_ops.h),$(PCMCIA)/pcmcia/driver_ops.h) OFILES += cb_shim.o CARDBUS= 3c575_cb.o epic_cb.o tulip_cb.o realtek_cb.o CARDBUS-FLAGS = -DCARDBUS -I$(LINUX)/include -I/usr/include -I$(PCMCIA) CB_SHIM = cb_shim.o endif all: pci-skeleton.o pci-scan.o cb_shim.o $(DRV_OFILES) tar: netdrivers.tgz $(OFILES) pci-scan.o pci-skeleton.o: pci-scan.h kern_compat.h pci-scan.o: pci-scan.h # We need to pick up 8390.h ne2k-pci.o: ne2k-pci.c $(LINUX)/drivers/net/8390.h $(CC) $(CPPFLAGS) $(CFLAGS) -I$(LINUX)/drivers/net/ -c $< cb_shim.o: cb_shim.c $(CC) $(CARDBUS-FLAGS) $(CFLAGS) -c $< -o $@ install: $(OFILES) install -m 444 pci-scan.o $(DRV_OFILES) $(MODULEDIR)/net/ @if [ -r cb_shim.o ]; then install -m 444 cb_shim.o $(MODULEDIR)/pcmcia/; fi @if [ "$(PREFIX)" = "" ]; then /sbin/depmod -a $(KERNVER);\ else echo " *** Run '/sbin/depmod -a' to update the module database.";\ fi netdrivers.tgz: Makefile *.[ch] netdrivers.spec tar cfvz $@ $^ rpm: netdrivers.tgz rpm -ta $^ # These are old-style CardBus drivers that don't need pci-scan and cb_shim. cardbus: $(CARDBUS) 3c575_cb.o: 3c59x.c $(CC) $(CARDBUS-FLAGS) $(CFLAGS) -c $< -o $@ epic_cb.o: epic100.c $(CC) $(CARDBUS-FLAGS) $(CFLAGS) -c $< -o $@ realtek_cb.o: rtl8139.c $(CC) $(CARDBUS-FLAGS) $(CFLAGS) -c $< -o $@ tulip_cb.o: tulip.c $(CC) $(CARDBUS-FLAGS) $(CFLAGS) -c $< -o $@ .PHONEY: all clean install cardbus tar clean: -rm -f *.o netdrivers.tgz