1 #---------------------------------------------------------------- |
1 # Comment/uncomment the following line to disable/enable debugging |
2 # |
2 #DEBUG = y |
3 # Makefile |
|
4 # |
|
5 # EtherCAT-RT-Modul |
|
6 # |
|
7 # $Id$ |
|
8 # |
|
9 #---------------------------------------------------------------- |
|
10 |
3 |
11 CONFIG_FILE = ../ethercat.conf |
|
12 |
4 |
13 ifeq ($(CONFIG_FILE),$(wildcard $(CONFIG_FILE))) |
5 # Add your debugging flag (or not) to CFLAGS |
14 include $(CONFIG_FILE) |
6 ifeq ($(DEBUG),y) |
|
7 DEBFLAGS = -O -g -DSHORT_DEBUG # "-O" is needed to expand inlines |
15 else |
8 else |
16 KERNELDIR = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/linux-2.4.20.CX1100-rthal5 |
9 DEBFLAGS = -O2 |
17 RTAIDIR = /vol/projekte/msr_messen_steuern_regeln/linux/kernel/2.4.20/include/rtai-24.1.13 |
|
18 RTLIBDIR = rt_lib |
|
19 endif |
10 endif |
20 |
11 |
21 CFLAGS = -O2 -Wall -Wuninitialized -D__KERNEL__ -DMODULE -DSERIALDEBUG -DMSR_NO_PROC -I$(KERNELDIR)/include -D_RTAI -I$(RTAIDIR)/include -I$(RTLIBDIR)/msr-include |
12 CFLAGS += $(DEBFLAGS) |
|
13 CFLAGS += -I.. |
|
14 |
|
15 RTLIB = /vol/projekte/msr_messen_steuern_regeln/linux/kernel_space/rt_lib-4.0.0-2.6krnl |
22 |
16 |
23 #Suchpfad für die Dateien aus dem RT-Lib-Verzeichnis |
17 #Suchpfad für die Dateien aus dem RT-Lib-Verzeichnis |
24 VPATH = $(RTLIBDIR)/msr-core:$(RTLIBDIR)/msr-control:$(RTLIBDIR)/msr-math:$(RTLIBDIR)/msr-misc:$(RTLIBDIR)/msr-utils |
18 VPATH := $(RTLIB)/msr-core:$(RTLIB)/msr-control:$(RTLIB)/msr-hwdriver:$(RTLIB)/msr-math:$(RTLIB)/msr-misc:$(RTLIB)/msr-utils |
25 |
19 |
26 MODULE = msr_modul.o |
20 #Datei aus dem RT-Libverzeichnis für dies Projekt |
27 SRC = msr_io.c |
21 RTSRC := msr_main.o msr_lists.o msr_charbuf.o msr_reg.o msr_interpreter.o msr_utils.o msr_messages.o msr_functiongen.o msr_base64.o msr_watchdog.o msr_proc.o msr_error_reg.o |
28 RTSRC = msr_main.c msr_lists.c msr_charbuf.c msr_reg.c msr_interpreter.c \ |
|
29 msr_utils.c msr_messages.c msr_base64.c msr_proc.c msr_error_reg.c |
|
30 ALLSRC = $(SRC) $(RTSRC) |
|
31 OBJ = $(ALLSRC:.c=.o) |
|
32 |
22 |
33 #---------------------------------------------------------------- |
23 ifneq ($(KERNELRELEASE),) |
|
24 # call from kernel build system |
34 |
25 |
35 all: .output_dirs .depend $(MODULE) Makefile |
|
36 |
26 |
37 $(MODULE): $(OBJ) |
27 EXTRA_CFLAGS := -I$(RTLIB)/msr-include -D_SIMULATION -I/usr/include -mhard-float |
38 @echo "Making module" |
|
39 $(LD) -r $(OBJ) -o $@ |
|
40 |
28 |
41 .c.o: |
29 #EXTRA_LDFLAGS := -L/usr/lib -lm |
42 @echo "Making obj $@" |
|
43 $(CC) -c $(CFLAGS) $< -o $@ |
|
44 |
30 |
45 .output_dirs: |
31 msr_modul-y := msr_module.o \ |
46 @echo "x-- Directories -------------" |
32 msr_jitter.o \ |
47 @echo "| Kernel $(KERNELDIR)" |
33 rt_lib/msr-core/msr_lists.o \ |
48 @echo "| RTAI $(RTAIDIR)" |
34 rt_lib/msr-core/msr_main.o \ |
49 @echo "| RT_lib $(RTLIBDIR)" |
35 rt_lib/msr-core/msr_charbuf.o \ |
50 @echo "x----------------------------" |
36 rt_lib/msr-core/msr_reg.o \ |
|
37 rt_lib/msr-core/msr_interpreter.o \ |
|
38 rt_lib/msr-core/msr_messages.o \ |
|
39 rt_lib/msr-core/msr_proc.o \ |
|
40 rt_lib/msr-core/msr_error_reg.o \ |
|
41 rt_lib/msr-utils/msr_utils.o \ |
|
42 rt_lib/msr-math/msr_base64.o \ |
|
43 libm.o |
|
44 |
|
45 |
|
46 obj-m := msr_modul.o |
|
47 |
|
48 |
|
49 |
|
50 else |
|
51 |
|
52 |
|
53 KERNELDIR := /lib/modules/$(shell uname -r)/build |
|
54 PWD := $(shell pwd) |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 default: |
|
60 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules |
|
61 |
|
62 endif |
|
63 |
|
64 |
|
65 clean: |
|
66 rm -f core .depend |
|
67 rm -rf .tmp_versions |
|
68 find -L -maxdepth 3 -name "*.o" -exec rm {} \; |
|
69 find -L -maxdepth 3 -name "*~" -exec rm {} \; |
|
70 find -L -maxdepth 3 -name "*.cmd" -exec rm {} \; |
|
71 find -L -maxdepth 3 -name "*.ko" -exec rm {} \; |
|
72 find -L -maxdepth 3 -name "*.mod.c" -exec rm {} \; |
51 |
73 |
52 depend .depend dep: |
74 depend .depend dep: |
53 $(CC) $(CFLAGS) -M $(SRC) > .depend |
75 $(CC) $(CFLAGS) -M *.c > .depend |
54 |
76 |
55 clean: |
|
56 rm -f *.o *~ core .depend |
|
57 |
77 |
58 #---------------------------------------------------------------- |
|
59 |
78 |
60 ifeq (.depend,$(wildcard .depend)) |
79 ifeq (.depend,$(wildcard .depend)) |
61 include .depend |
80 include .depend |
62 endif |
81 endif |
63 |
|
64 #---------------------------------------------------------------- |
|