drivers/Makefile
branchkernel2.6
changeset 22 e8c2cd004e0b
parent 16 f04e93b8af0f
child 27 d75ef6b46e33
--- a/drivers/Makefile	Fri Nov 25 10:16:50 2005 +0000
+++ b/drivers/Makefile	Fri Nov 25 14:52:34 2005 +0000
@@ -8,60 +8,34 @@
 #
 #----------------------------------------------------------------
 
-CONFIG_FILE = ../ethercat.conf
+ifneq ($(KERNELRELEASE),)
 
-ifeq ($(CONFIG_FILE),$(wildcard $(CONFIG_FILE)))
-include $(CONFIG_FILE)
-else
-KERNELDIR = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/linux-2.4.20.CX1100-rthal5
-RTAIDIR   = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/rtai-24.1.13
-RTLIBDIR  = rt_lib
-GCC_SYSTEMDIR = /usr/lib/gcc-lib/i486-suse-linux/3.3/include
-endif
+#----------------------------------------------------------------
+# Kbuild-Abschnitt
 
-CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ \
-	-DMODULE -I$(KERNELDIR)/include -nostdinc \
-	-isystem $(GCC_SYSTEMDIR)
+obj-m := 8139too-ecat.o
 
-ifdef CONFIG_SMP
-	CFLAGS += -D__SMP__ -DSMP
-endif
-
-MODULE = ecat_8139too.o
-OBJ = drv_8139too.o ec_device.o ec_master.o \
-	ec_slave.o ec_command.o ec_types.o
-SRC = $(OBJ:.o=.c)
+8139too-ecat-objs := 8139too.o ec_device.o ec_master.o \
+					ec_slave.o ec_command.o ec_types.o
 
 #----------------------------------------------------------------
 
-all: .output_dirs depend $(MODULE)
+else
 
-$(MODULE): $(OBJ)
-	$(LD) -r $(OBJ) -o $@
+#----------------------------------------------------------------
+# Default-Abschnitt
 
-.c.o:
-	$(CC) $(CFLAGS) -c $< -o $@
+CONFIG_FILE = ../ethercat.conf
+PWD = $(shell pwd)
 
-doc docs:
-	$(MAKE) -C .. doc
+include $(CONFIG_FILE) # Für KERNELDIR
 
-.output_dirs:
-	@echo "x-- Directories -------------"
-	@echo "| Kernel $(KERNELDIR)"
-	@echo "| RTAI   $(RTAIDIR)"
-	@echo "| RT_lib $(RTLIBDIR)"
-	@echo "x----------------------------"
-
-.depend depend dep:
-	$(CC) $(CFLAGS) -M $(SRC) > .depend
+default:
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
 
 clean:
-	rm -f *.o *~ core .depend
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
 
 #----------------------------------------------------------------
 
-ifeq (.depend,$(wildcard .depend))
-include .depend
 endif
-
-#----------------------------------------------------------------