rs232dbg/Makefile
changeset 9 144d220c8ca0
parent 5 6f2508af550c
child 10 67c739ece5d5
--- 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
+#----------------------------------------------------------------