]> rtime.felk.cvut.cz Git - CanFestival-3.git/blob - drivers/unix/Makefile.in
Accepted Vladimir Chren linux kernelspace port patch.
[CanFestival-3.git] / drivers / unix / Makefile.in
1 #! gmake
2
3 #
4 # Copyright (C) 2006 Laurent Bessard
5
6 # This file is part of canfestival, a library implementing the canopen
7 # stack
8
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
23
24 #ifneq ($(KERNELRELEASE),)
25 # Kbuild part of Makefile
26 obj-m := libcanfestival_$(TARGET).o
27 libcanfestival_$(TARGET)-objs := $(OBJS)
28
29 #else
30 # Normal Makefile
31 CC = SUB_CC
32 OPT_CFLAGS = -O2
33 PROG_CFLAGS = SUB_PROG_CFLAGS
34 OS_NAME = SUB_OS_NAME
35 ARCH_NAME = SUB_ARCH_NAME
36 PREFIX = SUB_PREFIX
37 TARGET = SUB_TARGET
38 CAN_DRIVER = SUB_CAN_DRIVER
39 TIMERS_DRIVER = SUB_TIMERS_DRIVER
40 ENABLE_DLL_DRIVERS = SUB_ENABLE_DLL_DRIVERS
41 BINUTILS_PREFIX = SUB_BINUTILS_PREFIX
42
43 INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(TIMERS_DRIVER)
44
45 OBJS = $(TARGET).o
46
47 # add timers driver if any
48 ifneq ($(TIMERS_DRIVER),timers_)
49 OBJS += ../$(TIMERS_DRIVER)/$(TIMERS_DRIVER).o
50 endif
51
52 SRC_HFILES = ../../include/$(TARGET)/applicfg.h ../../include/$(TARGET)/canfestival.h
53
54 TARGET_HFILES = $(PREFIX)/include/$(TARGET)/applicfg.h $(PREFIX)/include/$(TARGET)/canfestival.h
55
56 all: driver
57
58 ifeq ($(TIMERS_DRIVER), timers_kernel)
59 OBJS := $(shell echo $(OBJS) | sed "s:$(TARGET)_::g")
60 EXTRA_CFLAGS := $(shell echo $(INCLUDES) | sed "s:-I:-I$(src)/:g")
61 EXTRA_CFLAGS += $(PROG_CFLAGS)
62 KERNELDIR := SUB_KERNELDIR
63 export TARGET
64 export OBJS
65 export EXTRA_CFLAGS
66
67 driver: libcanfestival_$(TARGET)
68
69 libcanfestival_$(TARGET):
70         @echo Building [libcanfestival_$(TARGET).o]
71         $(MAKE) -C $(KERNELDIR) M=$(shell pwd) modules
72
73 clean:
74         $(MAKE) -C $(KERNELDIR) M=$(shell pwd) clean
75         rm -f Module.symvers
76
77 install:
78         
79
80 else
81 CFLAGS = SUB_OPT_CFLAGS
82
83 driver: $(OBJS)
84
85 %o: %c
86         $(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $<
87
88 #../$(TIMERS_DRIVER)/$(TIMERS_DRIVER).o:
89 #       $(MAKE) -C ../$(TIMERS_DRIVER) driver
90
91 #../$(CAN_DRIVER)/$(CAN_DRIVER).o:
92 #       $(MAKE) -C ../$(CAN_DRIVER) driver
93
94 libcanfestival_$(TARGET).a: $(OBJS)
95         @echo Building [libcanfestival_$(TARGET).a]
96         $(BINUTILS_PREFIX)ar rc $@ $(OBJS)
97         $(BINUTILS_PREFIX)ranlib $@
98
99 install: libcanfestival_$(TARGET).a
100         mkdir -p $(PREFIX)/lib/
101         mkdir -p $(PREFIX)/include/canfestival
102         cp libcanfestival_$(TARGET).a $(PREFIX)/lib/
103         cp $(SRC_HFILES) $(PREFIX)/include/canfestival
104
105 uninstall:
106         rm -f $(PREFIX)/lib/libcanfestival_$(TARGET).a
107         rm -f $(TARGET_HFILES)
108
109 clean:
110         rm -f $(OBJS)
111         rm -f libcanfestival_$(TARGET).a
112
113 endif
114 mrproper: clean
115
116 #endif