]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/Makefile
First integration step:
[lincan.git] / lincan / src / Makefile
index b83aa6dd039a539215b8e2a5cc26bd7e16e466d7..7f2b82077b5b1cf7ea321a30d67e90e99ef938fd 100644 (file)
@@ -1,27 +1,43 @@
 # Makefile for the Linux CAN-bus driver.
 # Written by Arnaud Westenberg email:arnaud@wanadoo.nl
 # This software is released under the GPL-License.
-# Version 0.7  6 Aug 2001
+# Version lincan-0.2  9 Aug 2003
 #
 # This version is adapted from uLan Communication driver
 # (C) Copyright 1999 by Pavel Pisa pisa@cmp.felk.cvut.cz
 #
 #*****************************************************************
 
+ifdef SUBDIRS
+SUBDIRS =
+endif
+
+ifneq ($(wildcard ../../../../../ocera.mk),)
+ifndef TOPDIR
+include ../../../../../ocera.mk
+else
+LINUX_DIR = ../../../../../kernel/linux/
+endif
+else
+OCERA_NOTDEF = 1
+all: 
+       @echo -e "You should go to the ocera/ directory and do 'make' to generate the ocera.mk file first.\nThanks."
+endif
+
 # Where to look for kernel
 # if not defined, sources of current running kernel are found
 #KERNEL_LOCATION=/usr/src/linux
 #KERNEL_LOCATION=/usr/src/linux-2.2.19
 #KERNEL_LOCATION=/usr/src/linux-2.2.22
-#KERNEL_LOCATION=/usr/src/linux-2.5.47
+#KERNEL_LOCATION=/usr/src/linux-2.6.0-test4
+#KERNEL_LOCATION=/home/cvs/ocera/ocera-build/kernel/linux
 
-# Comment-out next two lines, if you do not build driver 
-# in the OCERA source tree
-TOP=../../../../..
-KERNEL_LOCATION=$(TOP)/kernel/linux
+ifdef LINUX_DIR
+KERNEL_LOCATION = $(LINUX_DIR)
+endif
 
 # Enable debugging messages
-DEBUG = y
+#DEBUG = y
 
 # You can comment out the hardware you don't need. This will result in a smaller
 # driver. By default, all hardware is supported in the driver. See the README 
@@ -31,7 +47,11 @@ DEBUG = y
 
 SUPPORTED_CARDS = pip pccan smartcan nsi cc_can104 \
                  pc_i03 pcm3680 aim104 m437 pcccan ssv \
-                 bfadcan pikronisa template
+                 bfadcan pikronisa virtual template
+
+#SUPPORTED_CARDS = pcm3680 bfadcan pikronisa template
+
+#SUPPORTED_CARDS = pikronisa
 
 ########## Don't change anything under this line ################
 
@@ -53,6 +73,9 @@ MODULE_CHAR_LOC=/lib/modules/$(CURRENT)/misc
 endif
 endif
 
+TOPDIR = $(KERNEL_LOCATION)
+CONFIG_SHELL = TOPDIR=$(TOPDIR)
+
 KERNEL_VERSION := $(shell awk -F\" '/REL/ {print $$2}' \
        $(KERNEL_LOCATION)/include/linux/version.h | awk -F\- '{print $$1}')
 
@@ -91,8 +114,9 @@ O_TARGET     = can.o
 endif
 # Regular object files
 O_OBJS      += $(SUPPORTED_CARDS:%=%.o)
-O_OBJS       += main.o modparms.o setup.o sja1000.o i82527.o close.o ioctl.o \
-               open.o write.o read.o sja1000p.o irq.o select.o
+O_OBJS       += can_queue.o devcommon.o main.o modparms.o setup.o \
+               sja1000p.o sja1000.o i82527.o irq.o boardlist.o \
+               open.o proc.o close.o write.o read.o ioctl.o select.o
 # Objects with exported symbols (-DEXPORT_SYMTAB)
 OX_OBJS      = 
 # Module objects 
@@ -107,16 +131,24 @@ LX_OBJS      =
 EXTRA_CFLAGS +=
 
 # Linux 2.4.2 build system needs next
-can-objs := $(O_OBJS)
-obj-y := $(O_OBJS)
-obj-m := can.o
+can-objs = $(O_OBJS)
+obj-y = $(O_OBJS)
+obj-m = can.o
+
+ifndef KERNEL_MODULE_V26
+FINAL_MODULE_OBJS=$(obj-m)
+else
+FINAL_MODULE_OBJS=$(obj-m:%.o=%.ko)
+endif
 
 ########## Source/target independent buil of module #############
 
+#ifndef OCERA_NOTDEF
 all : default
+#endif
 
 default : make_this_module
-       cp can.o ../can.o
+       cp $(FINAL_MODULE_OBJS) ../$(FINAL_MODULE_OBJS)
 
 dep: make_this_module_dep
 
@@ -133,18 +165,27 @@ make_this_module: .supported_cards.h
        echo Module target $(obj-m)
        echo Module objects $(can-objs)
        DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR modules)
-       for f in $(obj-m:%.o=%) ; do if [ -f $$f.ko ] ; then cp -u $$f.ko $$f.o ; fi ; done
 
 make_this_module_dep:
        DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR dep)
 
 install_this_module: make_this_module
-       su -c "mkdir -v -p $(MODULE_CHAR_LOC); cp -v $(obj-m) $(MODULE_CHAR_LOC)"
-
-clean:
-       rm -f $(M_OBJS) $(MX_OBJS) $(O_OBJS) $(OX_OBJS) $(obj-m) $(obj-m:%.o=%.ko) \
-                       .*.o.flags .*.o.cmd .depend .supported_cards.h *~
+       su -c "mkdir -v -p $(MODULE_CHAR_LOC) && cp -v $(FINAL_MODULE_OBJS) $(MODULE_CHAR_LOC)"
 
 ifndef KERNEL_MODULE_V26
 include $(KERNEL_LOCATION)/Rules.make
+clean:
+       rm -f $(M_OBJS) $(MX_OBJS) $(O_OBJS) $(OX_OBJS) $(obj-m) \
+             .*.o.flags .*.o.cmd .*.ko.cmd .depend .supported_cards.h *~ \
+             ../$(FINAL_MODULE_OBJS)
+
+distclean: clean
+else
+clean:
+       rm -f $(M_OBJS) $(MX_OBJS) $(O_OBJS) $(OX_OBJS) $(obj-m:%.o=%.ko) \
+             $(obj-m:%.o=%.mod.o) .*.o.flags .*.o.cmd .*.ko.cmd .depend .supported_cards.h *~ \
+             ../$(FINAL_MODULE_OBJS)
+
+distclean: clean
 endif
+