drivers/Makefile
changeset 9 144d220c8ca0
parent 6 e36a85dc2730
child 10 67c739ece5d5
--- a/drivers/Makefile	Fri Nov 04 17:51:36 2005 +0000
+++ b/drivers/Makefile	Fri Nov 11 10:15:12 2005 +0000
@@ -1,36 +1,26 @@
-#################################################################
+#----------------------------------------------------------------
 #
 #  Makefile
 #
 #  IgH EtherCAT-Treiber
 #
-#  $Date$
-#  $Author$
+#  $Id$
 #
-#################################################################
+#----------------------------------------------------------------
 
-#KERNELDIR=/usr/src/linux
-#KERNELDIR=/home/rich/linux-2.4.20.CX1100-rthal5
-#KERNELDIR=./linux-2.4.20.CX1100-rthal5
+KERNEL_DIRS_FILE = ../kerneldirs.mk
 
-#IgH
+ifeq ($(KERNEL_DIRS_FILE),$(wildcard $(KERNEL_DIRS_FILE)))
+include $(KERNEL_DIRS_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
+endif
 
-#euler-nottuln
-#KERNELDIR = /usr/src/linux
-#RTAIDIR = /usr/src/rtai
-
-#patra
-#KERNELDIR = /usr/src/linux-2.4.20.CX1100-rthal5
-#RTAIDIR   = /usr/src/rtai-24.1.13
-
-#include $(KERNELDIR)/.config
-
-ECAT_8139_OBJ = drv_8139too.o ec_device.o ec_master.o \
-	ec_slave.o ec_command.o ec_types.o
-
+ifeq (.depend,$(wildcard .depend))
+include .depend
+endif
 
 CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE \
 	-I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include \
@@ -40,32 +30,34 @@
 	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)
 
-all: .depend ecat_8139too.o
+#----------------------------------------------------------------
 
-ecat_8139too.o: $(ECAT_8139_OBJ)
-	$(LD) -r $(ECAT_8139_OBJ) -o $@
+all: .output_dirs .depend $(MODULE)
+
+$(MODULE): $(OBJ)
+	$(LD) -r $(OBJ) -o $@
 
 .c.o:
-	$(CC) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) -c $< -o $@
 
 doc docs:
 	$(MAKE) -C .. doc
 
-#################################################################
+.output_dirs:
+	@echo "x-- Directories -------------"
+	@echo "| Kernel $(KERNELDIR)"
+	@echo "| RTAI   $(RTAIDIR)"
+	@echo "| RT_lib $(RTLIBDIR)"
+	@echo "x----------------------------"
 
 .depend:
-	$(CC) $(CFLAGS) -M *.c > .depend
-
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
-
-#################################################################
+	$(CC) $(CFLAGS) -M $(SRC) > .depend
 
 clean:
 	rm -f *.o *~ core .depend
 
-#################################################################
-
+#----------------------------------------------------------------