From cc1811f284f00d214e198cb20b466d261201385b Mon Sep 17 00:00:00 2001 From: ppisa Date: Mon, 29 Dec 2003 01:42:15 +0000 Subject: [PATCH] Main OMK conversion step for CAN components. Recent MAKE program is required !!! The updated and new CAN components are committed into OCERA CVS now. The integration is not fully finished yet. New OMK make-system build all object code out of sources directory (in the OCERA top-level "build" directory). Compiled libraries, headers, programs and modules are stored into OCERA top-level directory "compiled". Please: excuse probable problems caused by massive changes. Critique and constructive suggestions are welcome. --- lincan/Makefile | 50 ++------- lincan/Makefile.omk | 2 + lincan/src/Makefile | 201 ++--------------------------------- lincan/src/Makefile.omk | 18 ++++ lincan/src/boardlist.c | 2 +- lincan/src/supported_cards.h | 16 +++ lincan/utils/Makefile | 55 ++-------- lincan/utils/Makefile.omk | 12 +++ 8 files changed, 76 insertions(+), 280 deletions(-) create mode 100644 lincan/Makefile.omk create mode 100644 lincan/src/Makefile.omk create mode 100644 lincan/src/supported_cards.h create mode 100644 lincan/utils/Makefile.omk diff --git a/lincan/Makefile b/lincan/Makefile index d643545..f595272 100644 --- a/lincan/Makefile +++ b/lincan/Makefile @@ -1,46 +1,14 @@ -# -# 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 -# -# Changes made by Pavel Pisa pisa@cmp.felk.cvut.cz as preliminary -# study for OCERA Real Time CAN/CANOpen project ORTCAN -# -########## The following options can be changed ########## +# Generic directory or leaf node makefile for OCERA make framework -SUBDIRS = src utils - -ifndef SOURCES_DIR -SOURCES_DIR := $(shell ( pwd -L ) ) +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) endif -ifneq ($(wildcard $(SOURCES_DIR)/Standalone.mk),) -# Standalone make outside of OCERA framework - -all: default - -.PHONY: dep default subdirs clean cleandepend -.PHONY: check-dir include-pass library-pass binary-pass utils-pass kernel-lib-pass kernel-pass - -dirs = src utils - -default dep clean install utils-pass kernel-pass: - $(foreach dir, $(dirs), $(MAKE) -C $(SOURCES_DIR)/$(dir) \ - SOURCES_DIR=$(SOURCES_DIR)/$(dir) $@ ; ) - -else -# Build in structure of OCERA framework - -TOPDIR = $(LINUX_DIR) - -ifneq ($(wildcard ../../../../ocera.mk),) -include ../../../../ocera.mk -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 +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules endif diff --git a/lincan/Makefile.omk b/lincan/Makefile.omk new file mode 100644 index 0000000..d43b19d --- /dev/null +++ b/lincan/Makefile.omk @@ -0,0 +1,2 @@ +SUBDIRS = src utils + diff --git a/lincan/src/Makefile b/lincan/src/Makefile index 1a0f0e9..f595272 100644 --- a/lincan/src/Makefile +++ b/lincan/src/Makefile @@ -1,199 +1,14 @@ -# Makefile for the Linux CAN-bus driver. -# Written by Arnaud Westenberg email:arnaud@wanadoo.nl -# This software is released under the GPL-License. -# Version lincan-0.2 9 Aug 2003 -# -# This Makefile version is adapted from uLan Communication driver -# (C) Copyright 1999 by Pavel Pisa pisa@cmp.felk.cvut.cz -# -#***************************************************************** +# Generic directory or leaf node makefile for OCERA make framework -# Begin of OCERA framework header -ifdef SUBDIRS -SUBDIRS = +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) endif -ifneq ($(wildcard ../Standalone.mk),) -# Standalone make outside of OCERA framework +ifeq ($(MAKERULES_DIR),) all : default - -.PHONY: kernel-pass utils-pass - -kernel-pass : 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 -#KERNEL_LOCATION=/usr/src/linux-2.2.19 -#KERNEL_LOCATION=/usr/src/linux-2.2.22 -#KERNEL_LOCATION=/usr/src/linux-2.6.0-test4 -#KERNEL_LOCATION=/home/cvs/ocera/ocera-build/kernel/linux - - -# Enable debugging messages -#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 -# file for a description of the supported hardware. -# pccan Not to be confused with PCCCAN!!! -# pcccan Not to be confused with PCCAN!!! - -SUPPORTED_CARDS = pip pccan smartcan nsi cc_can104 \ - pc_i03 pcm3680 aim104 m437 pcccan ssv \ - bfadcan pikronisa virtual template - -#SUPPORTED_CARDS = pcm3680 bfadcan pikronisa template - -#SUPPORTED_CARDS = virtual - -########## Don't change anything under this line ################ - -# currently running kernel -CURRENT=$(shell uname -r) -KERNEL_NEW=$(shell if [ -d /lib/modules/$(CURRENT)/build ] ; \ - then echo yes ; else echo no ; fi ) - -#KERNEL_LOCATION=/usr/src/kernel/$(CURRENT) -#KERNEL_LOCATION=/lib/modules/$(CURRENT)/build - -ifndef KERNEL_LOCATION -ifeq ($(KERNEL_NEW),yes) -KERNEL_LOCATION=/lib/modules/$(CURRENT)/build -MODULE_CHAR_LOC=/lib/modules/$(CURRENT)/kernel/drivers/char -else -KERNEL_LOCATION=/usr/src/linux -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}') - -PROC_FS := $(shell awk -F\ '/PROC_FS/ {print $$3}' \ - $(KERNEL_LOCATION)/include/linux/autoconf.h) - -DEVFS_FS := $(shell awk -F\ '/DEVFS_FS/ {print $$3}' \ - $(KERNEL_LOCATION)/include/linux/autoconf.h) - -KERNEL_MODULE_V26 := $(shell echo $(KERNEL_VERSION) \ - | sed -n 's/^.*2\.[5-9]\..*$$/yes/p') - -ifdef DEBUG - EXTRA_CFLAGS += -DCAN_DEBUG - EXTRA_CFLAGS += -ggdb -endif - -ifndef MODVERSIONS -# EXTRA_CFLAGS += -DNOVER -#else -# EXTRA_CFLAGS += -DMODVERSIONS -endif - -ifdef DEVFS_FS - EXTRA_CFLAGS += -DWITH_DEVFS_FS -endif - -ifdef PROC_FS - O_OBJS += proc.o -endif - -# Target object file if any -# this must be undefined for 2.5.xx kernels -ifndef KERNEL_MODULE_V26 -O_TARGET = can.o -endif -# Regular object files -O_OBJS += $(SUPPORTED_CARDS:%=%.o) -O_OBJS += can_queue.o can_quekern.o devcommon.o main.o modparms.o \ - setup.o finish.o irq.o boardlist.o \ - sja1000p.o sja1000.o i82527.o \ - open.o proc.o close.o write.o read.o \ - ioctl.o select.o fasync.o -# Objects with exported symbols (-DEXPORT_SYMTAB) -OX_OBJS = -# Module objects -M_OBJS = $(O_TARGET) -# Module only objects with exported symbols (-DEXPORT_SYMTAB) -MX_OBJS = -# Kernel only objects -L_OBJS = -# Kernel only objects with exported symbols (-DEXPORT_SYMTAB) -LX_OBJS = -# Additional CFLAGS -EXTRA_CFLAGS += - -# 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) -else -FINAL_MODULE_OBJS=$(obj-m:%.o=%.ko) -endif - -########## Source/target independent build of module ############# - -default : make_this_module - cp $(FINAL_MODULE_OBJS) ../$(FINAL_MODULE_OBJS) - -dep: make_this_module_dep - -install : install_this_module - -.supported_cards.h: Makefile - echo >.supported_cards.h - $(foreach card, $(SUPPORTED_CARDS), \ - echo \#define ENABLE_CARD_$(card) 1 >>.supported_cards.h ;) - -make_this_module: .supported_cards.h - echo Linux kernel version $(KERNEL_VERSION) - echo Linux kernel sources $(KERNEL_LOCATION) - echo Module target $(obj-m) - echo Module objects $(can-objs) - DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR modules) - -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 $(FINAL_MODULE_OBJS) $(MODULE_CHAR_LOC)" - -clean: - 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 +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules endif diff --git a/lincan/src/Makefile.omk b/lincan/src/Makefile.omk new file mode 100644 index 0000000..20ab731 --- /dev/null +++ b/lincan/src/Makefile.omk @@ -0,0 +1,18 @@ +rtlinux_INCLUDES = -I $(srcdir)/../include +kernel_INCLUDES = -I $(srcdir)/../include +#kernel_INCLUDES += -DCAN_DEBUG +kernel_INCLUDES += -DWITH_DEVFS_FS + +kernel_MODULES = lincan + +#rtlinux_MODULES = lincan + +lincan_cards_SOURCES = pip.c pccan.c smartcan.c nsi.c cc_can104.c \ + pc_i03.c pcm3680.c aim104.c m437.c pcccan.c ssv.c \ + bfadcan.c pikronisa.c virtual.c template.c + +lincan_SOURCES = can_queue.c can_quekern.c devcommon.c main.c modparms.c \ + setup.c finish.c irq.c boardlist.c \ + sja1000p.c sja1000.c i82527.c \ + open.c proc.c close.c write.c read.c \ + ioctl.c select.c fasync.c proc.c $(lincan_cards_SOURCES) diff --git a/lincan/src/boardlist.c b/lincan/src/boardlist.c index 9075e7a..f85dcb6 100644 --- a/lincan/src/boardlist.c +++ b/lincan/src/boardlist.c @@ -10,7 +10,7 @@ #include "../include/can_sysdep.h" #include "../include/main.h" -#include ".supported_cards.h" +#include "supported_cards.h" #include "../include/pip.h" #include "../include/pccan.h" diff --git a/lincan/src/supported_cards.h b/lincan/src/supported_cards.h new file mode 100644 index 0000000..fcb7ef8 --- /dev/null +++ b/lincan/src/supported_cards.h @@ -0,0 +1,16 @@ + +#define ENABLE_CARD_pip 1 +#define ENABLE_CARD_pccan 1 +#define ENABLE_CARD_smartcan 1 +#define ENABLE_CARD_nsi 1 +#define ENABLE_CARD_cc_can104 1 +#define ENABLE_CARD_pc_i03 1 +#define ENABLE_CARD_pcm3680 1 +#define ENABLE_CARD_aim104 1 +#define ENABLE_CARD_m437 1 +#define ENABLE_CARD_pcccan 1 +#define ENABLE_CARD_ssv 1 +#define ENABLE_CARD_bfadcan 1 +#define ENABLE_CARD_pikronisa 1 +#define ENABLE_CARD_virtual 1 +#define ENABLE_CARD_template 1 diff --git a/lincan/utils/Makefile b/lincan/utils/Makefile index 1912466..f595272 100644 --- a/lincan/utils/Makefile +++ b/lincan/utils/Makefile @@ -1,49 +1,14 @@ -# 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 -# -# Changes made by Pavel Pisa pisa@cmp.felk.cvut.cz as preliminary -# study for OCERA Real Time CAN/CANOpen project ORTCAN -# -########## The following options can be changed ########## +# Generic directory or leaf node makefile for OCERA make framework -# Compiler -ifndef CC -CC = gcc +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) endif -CFLAGS = -I../include -O2 -Wall - -all: default - -.PHONY: dep default subdirs clean cleandepend -.PHONY: check-dir include-pass library-pass binary-pass utils-pass kernel-pass - -default: utils - -utils-pass: utils - -dep: - $(CC) $(CFLAGS) $(CPPFLAGS) -w -E -M *.c $(MORE_C_FILES) > .depend - -install: - echo Nothing to install - -utils: rxtx sendburst readburst send can-proxy - -rxtx: rxtx.o - -sendburst: sendburst.o - -readburst: readburst.o - -send: send.o - -clean : - rm -f rxtx sendburst readburst send can-proxy *.o .depend - -distclean : clean - --include .depend +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif diff --git a/lincan/utils/Makefile.omk b/lincan/utils/Makefile.omk new file mode 100644 index 0000000..6c1b093 --- /dev/null +++ b/lincan/utils/Makefile.omk @@ -0,0 +1,12 @@ +INCLUDES = -I $(srcdir)/../include + +utils_PROGRAMS = readburst sendburst rxtx send can_proxy + +readburst_SOURCES = readburst.c +sendburst_SOURCES = sendburst.c +rxtx_SOURCES = rxtx.c +send_SOURCES = send.c +can_proxy_SOURCES = can-proxy.c + + + -- 2.39.2