rt/Makefile
changeset 9 144d220c8ca0
parent 0 05c992bf5847
child 10 67c739ece5d5
equal deleted inserted replaced
8:f2ebe943c686 9:144d220c8ca0
     1 #IgH
     1 #----------------------------------------------------------------
       
     2 #
       
     3 #  Makefile
       
     4 #
       
     5 #  EtherCAT-RT-Modul
       
     6 #
       
     7 #  $Id$
       
     8 #
       
     9 #----------------------------------------------------------------
       
    10 
       
    11 KERNEL_DIRS_FILE = ../kerneldirs.mk
       
    12 
       
    13 ifeq ($(KERNEL_DIRS_FILE),$(wildcard $(KERNEL_DIRS_FILE)))
       
    14 include $(KERNEL_DIRS_FILE)
       
    15 else
     2 KERNELDIR = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/linux-2.4.20.CX1100-rthal5
    16 KERNELDIR = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/linux-2.4.20.CX1100-rthal5
     3 RTAIDIR   = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/rtai-24.1.13
    17 RTAIDIR   = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/rtai-24.1.13
     4 RTLIBDIR = rt_lib
    18 RTLIBDIR = rt_lib
     5 
    19 endif
     6 #euler-nottuln
       
     7 #KERNELDIR = /usr/src/linux
       
     8 #RTAIDIR = /usr/src/rtai
       
     9 
       
    10 
       
    11 #patra
       
    12 #KERNELDIR = /usr/src/linux-2.4.20.CX1100-rthal5
       
    13 #RTAIDIR   = /usr/src/rtai-24.1.13
       
    14 
       
    15 RTLIBDIR=rt_lib
       
    16 
       
    17 #include $(KERNELDIR)/.config
       
    18 
       
    19 #CFLAGS = -DRTAI -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include \
       
    20 #	-Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer \
       
    21 #	-pipe -mpreferred-stack-boundary=2 -march=i686 -nostdinc -iwithprefix include
       
    22 
       
    23 CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE -DSERIALDEBUG -DMSR_NO_PROC -I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include
       
    24 
       
    25 #CFLAGS += -DSIMULATION
       
    26 #LDFLAGS = 
       
    27 
       
    28 #VPATH = $(RTLIBDIR)/
       
    29 
       
    30 TARGET = msr_modul
       
    31 MODULE = $(TARGET).o
       
    32 
       
    33 SRC = msr_io.c 
       
    34 
       
    35 #Suchpfad für die Dateien aus dem RT-Lib-Verzeichnis
       
    36 VPATH = $(RTLIBDIR)/msr-core:$(RTLIBDIR)/msr-control:$(RTLIBDIR)/msr-math:$(RTLIBDIR)/msr-misc:$(RTLIBDIR)/msr-utils
       
    37 
       
    38 #Datei aus dem RT-Libverzeichnis für dies Projekt
       
    39 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
       
    40 
       
    41 ALLSRC = $(SRC) $(RTSRC)
       
    42 
       
    43 OBJS = $(ALLSRC:.c=.o)  
       
    44 
       
    45 
       
    46 all: .depend $(TARGET).o Makefile
       
    47 
       
    48 $(TARGET).o: $(SRC:.c=.o) $(RTSRC:.c=.o)
       
    49 	$(LD) -r $(OBJS)  -o $@ $(LDFLAGS)
       
    50 
       
    51 install: msr_modul.o
       
    52 	lsmod | grep cif-rtai >/dev/null 2>&1 && sudo rmmod msr_modul || true
       
    53 	sudo insmod msr_modul.o
       
    54 
       
    55 clean:
       
    56 	rm -f *.o *~ core .depend
       
    57 
       
    58 depend .depend dep:
       
    59 	$(CC) $(CFLAGS) -M *.c > $@
       
    60 
       
    61 
       
    62 
       
    63 
    20 
    64 ifeq (.depend,$(wildcard .depend))
    21 ifeq (.depend,$(wildcard .depend))
    65 include .depend
    22 include .depend
    66 endif
    23 endif
    67 
    24 
       
    25 CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE -DSERIALDEBUG -DMSR_NO_PROC -I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include
    68 
    26 
    69 #all: msr_module.o
    27 #Suchpfad für die Dateien aus dem RT-Lib-Verzeichnis
    70 #
    28 VPATH = $(RTLIBDIR)/msr-core:$(RTLIBDIR)/msr-control:$(RTLIBDIR)/msr-math:$(RTLIBDIR)/msr-misc:$(RTLIBDIR)/msr-utils
    71 #msr_io.o: msr_io.c msr_io.h
       
    72 #	$(CC) $(CFLAGS) -c -o $@ $<
       
    73 #
       
    74 #msr_module.o: msr_io.o
       
    75 #	$(LD) -r -o $@ $^
       
    76 #
       
    77 
    29 
    78 #                  $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
    30 MODULE = msr_modul.o
       
    31 SRC = msr_io.c
       
    32 RTSRC = msr_main.c msr_lists.c msr_charbuf.c msr_reg.c msr_interpreter.c \
       
    33 	msr_utils.c msr_messages.c msr_base64.c msr_proc.c msr_error_reg.c
       
    34 ALLSRC = $(SRC) $(RTSRC)
       
    35 OBJ = $(ALLSRC:.c=.o)
    79 
    36 
       
    37 #----------------------------------------------------------------
    80 
    38 
    81 #clean:
    39 all: .output_dirs .depend $(MODULE) Makefile
    82 #	rm -f *.o *~ core
       
    83 
    40 
       
    41 $(MODULE): $(OBJ)
       
    42 	@echo "Making module"
       
    43 	$(LD) -r $(OBJ) -o $@
       
    44 
       
    45 .c.o:
       
    46 	@echo "Making obj $@"
       
    47 	$(CC) -c $(CFLAGS) $< -o $@
       
    48 
       
    49 .output_dirs:
       
    50 	@echo "x-- Directories -------------"
       
    51 	@echo "| Kernel $(KERNELDIR)"
       
    52 	@echo "| RTAI   $(RTAIDIR)"
       
    53 	@echo "| RT_lib $(RTLIBDIR)"
       
    54 	@echo "x----------------------------"
       
    55 
       
    56 depend .depend dep:
       
    57 	$(CC) $(CFLAGS) -M $(SRC) > .depend
       
    58 
       
    59 clean:
       
    60 	rm -f *.o *~ core .depend
       
    61 
       
    62 #----------------------------------------------------------------