Verbesserte Makefiles (Kernel-Verzeichnisse nicht mehr im SVN).
authorFlorian Pose <fp@igh-essen.com>
Fri, 11 Nov 2005 10:15:12 +0000
changeset 9 144d220c8ca0
parent 8 f2ebe943c686
child 10 67c739ece5d5
Verbesserte Makefiles (Kernel-Verzeichnisse nicht mehr im SVN).
drivers/Makefile
mini/Makefile
rs232dbg/Makefile
rt/Makefile
user/Makefile
--- 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
 
-#################################################################
-
+#----------------------------------------------------------------
--- a/mini/Makefile	Fri Nov 04 17:51:36 2005 +0000
+++ b/mini/Makefile	Fri Nov 11 10:15:12 2005 +0000
@@ -8,38 +8,44 @@
 #
 #----------------------------------------------------------------
 
-EC_DIR = /vol/projekte/msr_messen_steuern_regeln/ethercat
+KERNEL_DIRS_FILE = ../kerneldirs.mk
 
-#KERNELDIR = $(EC_DIR)/linux-2.4.20.CX1100-rthal5-kdb
-KERNELDIR = $(EC_DIR)/linux-2.4.20-kdb
-#KERNELDIR = /usr/src/linux
+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
+
+ifeq (.depend,$(wildcard .depend))
+include .depend
+endif
 
 CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ \
 	-DMODULE -I$(KERNELDIR)/include
 
 MODULE = ec_mini_mod.o
-
 SRC = ec_mini.c
 OBJ = $(SRC:.c=.o)
 
 #----------------------------------------------------------------
 
-all: .depend Makefile $(MODULE)
+all: .output_dirs .depend Makefile $(MODULE)
 
 $(MODULE): $(OBJ)
 	$(LD) -r $(OBJ) -o $@
 
-#----------------------------------------------------------------
+.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
 
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
-
-#----------------------------------------------------------------
-
 clean:
 	rm -f *.o *~ core .depend
 
--- a/rs232dbg/Makefile	Fri Nov 04 17:51:36 2005 +0000
+++ b/rs232dbg/Makefile	Fri Nov 11 10:15:12 2005 +0000
@@ -1,37 +1,55 @@
+#----------------------------------------------------------------
+#
+#  Makefile
+#
+#  Kernel-Debugging über die serielle Schnittstelle
+#
+#  $Id$
+#
+#----------------------------------------------------------------
 
-MSRDIR = /vol/projekte/msr_messen_steuern_regeln
-ECATDIR = $(MSRDIR)/ethercat
+KERNEL_DIRS_FILE = ../kerneldirs.mk
 
-KERNELDIR = $(ECATDIR)/linux-2.4.20.CX1100-rthal5-kdb
-RTAIDIR   = $(MSRDIR)/linux/kernel/2.4.20/include/rtai-24.1.13
+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
+
+ifeq (.depend,$(wildcard .depend))
+include .depend
+endif
 
 CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE \
 	-I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include
 
-TARGET = sdbg
-MODULE = $(TARGET).o
+MODULE = sdbg.o
+SRC = rs232dbg.c aip_com.c
+OBJ = $(SRC:.c=.o)
 
-SRC = rs232dbg.c aip_com.c
+#----------------------------------------------------------------
 
-ALLSRC = $(SRC)
+all: .output_dirs .depend $(MODULE) Makefile
 
-OBJS = $(ALLSRC:.c=.o)  
+$(MODULE): $(OBJ)
+	$(LD) -r $(OBJ) -o $@
 
-all: .depend $(TARGET).o Makefile
+.c.o:
+	$(CC) -c $(CFLAGS) $< -o $@
 
-$(TARGET).o: $(SRC:.c=.o) $(RTSRC:.c=.o)
-	$(LD) -r $(OBJS)  -o $@ $(LDFLAGS)
+.output_dirs:
+	@echo "x-- Directories -------------"
+	@echo "| Kernel $(KERNELDIR)"
+	@echo "| RTAI   $(RTAIDIR)"
+	@echo "| RT_lib $(RTLIBDIR)"
+	@echo "x----------------------------"
 
-install: msr_modul.o
-	lsmod | grep cif-rtai >/dev/null 2>&1 && sudo rmmod msr_modul || true
-	sudo insmod msr_modul.o
+depend .depend dep:
+	$(CC) $(CFLAGS) -M $(SRC) > .depend
 
 clean:
 	rm -f *.o *~ core .depend
 
-depend .depend dep:
-	$(CC) $(CFLAGS) -M *.c > $@
-
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+#----------------------------------------------------------------
--- a/rt/Makefile	Fri Nov 04 17:51:36 2005 +0000
+++ b/rt/Makefile	Fri Nov 11 10:15:12 2005 +0000
@@ -1,83 +1,62 @@
-#IgH
+#----------------------------------------------------------------
+#
+#  Makefile
+#
+#  EtherCAT-RT-Modul
+#
+#  $Id$
+#
+#----------------------------------------------------------------
+
+KERNEL_DIRS_FILE = ../kerneldirs.mk
+
+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
-
-#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
-
-RTLIBDIR=rt_lib
-
-#include $(KERNELDIR)/.config
-
-#CFLAGS = -DRTAI -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include \
-#	-Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer \
-#	-pipe -mpreferred-stack-boundary=2 -march=i686 -nostdinc -iwithprefix include
-
-CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE -DSERIALDEBUG -DMSR_NO_PROC -I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include
-
-#CFLAGS += -DSIMULATION
-#LDFLAGS = 
-
-#VPATH = $(RTLIBDIR)/
-
-TARGET = msr_modul
-MODULE = $(TARGET).o
-
-SRC = msr_io.c 
-
-#Suchpfad für die Dateien aus dem RT-Lib-Verzeichnis
-VPATH = $(RTLIBDIR)/msr-core:$(RTLIBDIR)/msr-control:$(RTLIBDIR)/msr-math:$(RTLIBDIR)/msr-misc:$(RTLIBDIR)/msr-utils
-
-#Datei aus dem RT-Libverzeichnis für dies Projekt
-RTSRC = msr_main.c msr_lists.c msr_charbuf.c msr_reg.c msr_interpreter.c msr_utils.c msr_messages.c msr_base64.c msr_proc.c msr_error_reg.c
-
-ALLSRC = $(SRC) $(RTSRC)
-
-OBJS = $(ALLSRC:.c=.o)  
-
-
-all: .depend $(TARGET).o Makefile
-
-$(TARGET).o: $(SRC:.c=.o) $(RTSRC:.c=.o)
-	$(LD) -r $(OBJS)  -o $@ $(LDFLAGS)
-
-install: msr_modul.o
-	lsmod | grep cif-rtai >/dev/null 2>&1 && sudo rmmod msr_modul || true
-	sudo insmod msr_modul.o
-
-clean:
-	rm -f *.o *~ core .depend
-
-depend .depend dep:
-	$(CC) $(CFLAGS) -M *.c > $@
-
-
-
+endif
 
 ifeq (.depend,$(wildcard .depend))
 include .depend
 endif
 
+CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE -DSERIALDEBUG -DMSR_NO_PROC -I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include
 
-#all: msr_module.o
-#
-#msr_io.o: msr_io.c msr_io.h
-#	$(CC) $(CFLAGS) -c -o $@ $<
-#
-#msr_module.o: msr_io.o
-#	$(LD) -r -o $@ $^
-#
+#Suchpfad für die Dateien aus dem RT-Lib-Verzeichnis
+VPATH = $(RTLIBDIR)/msr-core:$(RTLIBDIR)/msr-control:$(RTLIBDIR)/msr-math:$(RTLIBDIR)/msr-misc:$(RTLIBDIR)/msr-utils
 
-#                  $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+MODULE = msr_modul.o
+SRC = msr_io.c
+RTSRC = msr_main.c msr_lists.c msr_charbuf.c msr_reg.c msr_interpreter.c \
+	msr_utils.c msr_messages.c msr_base64.c msr_proc.c msr_error_reg.c
+ALLSRC = $(SRC) $(RTSRC)
+OBJ = $(ALLSRC:.c=.o)
 
+#----------------------------------------------------------------
 
-#clean:
-#	rm -f *.o *~ core
+all: .output_dirs .depend $(MODULE) Makefile
 
+$(MODULE): $(OBJ)
+	@echo "Making module"
+	$(LD) -r $(OBJ) -o $@
+
+.c.o:
+	@echo "Making obj $@"
+	$(CC) -c $(CFLAGS) $< -o $@
+
+.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
+
+clean:
+	rm -f *.o *~ core .depend
+
+#----------------------------------------------------------------
--- a/user/Makefile	Fri Nov 04 17:51:36 2005 +0000
+++ b/user/Makefile	Fri Nov 11 10:15:12 2005 +0000
@@ -2,8 +2,7 @@
 #
 #  M a k e f i l e
 #
-#  $LastChangedDate$
-#  $Author$
+#  $Id$
 #
 #----------------------------------------------------------------