X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/f2fcdbb5f9333a58a08f56daaca8cad7e5a95699..5bef5c531e98c252f89eeeeb9645bb0251896fda:/lincan/src/Makefile diff --git a/lincan/src/Makefile b/lincan/src/Makefile index 01c6d09..1b1f8ef 100644 --- a/lincan/src/Makefile +++ b/lincan/src/Makefile @@ -3,11 +3,41 @@ # This software is released under the GPL-License. # Version lincan-0.2 9 Aug 2003 # -# This version is adapted from uLan Communication driver +# This Makefile version is adapted from uLan Communication driver # (C) Copyright 1999 by Pavel Pisa pisa@cmp.felk.cvut.cz # #***************************************************************** +# Begin of OCERA framework header +ifdef SUBDIRS +SUBDIRS = +endif +ifneq ($(wildcard ../Standalone.mk),) +# Standalone make outside of OCERA framework + +all : default + +else +# Build in structure of OCERA framework + +ifneq ($(wildcard ../../../../../ocera.mk),) +ifndef TOPDIR +include ../../../../../ocera.mk +else +LINUX_DIR = ../../../../../kernel/linux/ +endif +else +all: + @echo -e "\nTo build LinCAN driver for OCERA framework, ocera.mk file have" + @echo -e "to be generated first. Go to ocera/ directory and do 'make', please." + @echo -e "If standalone build is required, mark lincan/ by 'touch ../Standalone.mk'.\n" +endif +ifdef LINUX_DIR +KERNEL_LOCATION = $(LINUX_DIR) +endif +endif +# End of OCERA framework header + # Where to look for kernel # if not defined, sources of current running kernel are found #KERNEL_LOCATION=/usr/src/linux @@ -16,6 +46,7 @@ #KERNEL_LOCATION=/usr/src/linux-2.6.0-test4 #KERNEL_LOCATION=/home/cvs/ocera/ocera-build/kernel/linux + # Enable debugging messages #DEBUG = y @@ -31,7 +62,7 @@ SUPPORTED_CARDS = pip pccan smartcan nsi cc_can104 \ #SUPPORTED_CARDS = pcm3680 bfadcan pikronisa template -#SUPPORTED_CARDS = pikronisa +#SUPPORTED_CARDS = virtual ########## Don't change anything under this line ################ @@ -53,6 +84,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}') @@ -93,7 +127,7 @@ endif O_OBJS += $(SUPPORTED_CARDS:%=%.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 close.o write.o read.o ioctl.o select.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,10 +141,10 @@ LX_OBJS = # Additional CFLAGS EXTRA_CFLAGS += -# Linux 2.4.2 build system needs next -can-objs := $(O_OBJS) -obj-y := $(O_OBJS) -obj-m := can.o +# Linux 2.4.2 and newer build system needs next +can-objs = $(O_OBJS) +obj-y = $(O_OBJS) +obj-m = can.o ifndef KERNEL_MODULE_V26 FINAL_MODULE_OBJS=$(obj-m) @@ -118,9 +152,7 @@ else FINAL_MODULE_OBJS=$(obj-m:%.o=%.ko) endif -########## Source/target independent buil of module ############# - -all : default +########## Source/target independent build of module ############# default : make_this_module cp $(FINAL_MODULE_OBJS) ../$(FINAL_MODULE_OBJS) @@ -148,9 +180,14 @@ install_this_module: make_this_module su -c "mkdir -v -p $(MODULE_CHAR_LOC) && cp -v $(FINAL_MODULE_OBJS) $(MODULE_CHAR_LOC)" clean: - rm -f $(M_OBJS) $(MX_OBJS) $(O_OBJS) $(OX_OBJS) $(obj-m) $(obj-m:%.o=%.ko) \ - $(obj-m:%.o=%.mod.o) .*.o.flags .*.o.cmd .*.ko.cmd .depend .supported_cards.h *~ + rm -f $(M_OBJS) $(MX_OBJS) $(O_OBJS) $(OX_OBJS) $(obj-m) \ + .*.o.flags .*.o.cmd .*.ko.cmd .depend .supported_cards.h *~ \ + $(obj-m:%.o=%.mod.o) $(FINAL_MODULE_OBJS) ../$(FINAL_MODULE_OBJS) + +distclean: clean + ifndef KERNEL_MODULE_V26 include $(KERNEL_LOCATION)/Rules.make endif +