📄 makefile-k2.4
字号:
### can4linux -- LINUX CAN device driver Makefile## Copyright (c) 2001/2/3 port GmbH Halle/Saale# (c) 2001/2/3 Heinz-J黵gen Oertel (oe@port.de)## to compile the can4linux device driver,# please select some configuration variables.# eg. the target hardware TARGET=# with or without compiled debug-support DEBUG=## Modified and extended to support Generic i82527 cards and# the SBS PC7compact DINrail mounted industry PC# by FOCUS Software Engineering Pty Ltd <www.focus-sw.com>## Modified and extended to support the esd elctronic system# design gmbh PC/104-CAN Card (www.esd-electronics.com)# by Jean-Jacques Tchouto (tchouto@fokus.fraunhofer.de)## SSV TRM/816 support by Sven Geggus <geggus@iitb.fraunhofer.de>## $Id: Makefile-k2.4,v 1.2 2006/06/02 12:25:35 oe Exp $### Used release tag for this software versionVERSION=3REL=4.1RELEASE=CAN4LINUX-$(VERSION)_$(REL)DVERSION=$(VERSION).$(REL)#KERNEL_SRC = /usr/src/linuxKERNEL_SRC = /lib/modules/2.4.18/build# be prepared for RTLinuxLINUXTARGET=LINUXOS#LINUXTARGET=RTLinuxKVERSION= $(shell uname -r)CONFIG := $(shell uname -n)CTAGS = ctags --c-types=dtvfCTAGS = elvtags -tsevlTITLE = CAN driver can4linux## The CAN driver major device number# development starts with major=63# (LOCAL/EXPERIMENTAL USE)# The new linux/Documentation/devices.txt defines major=91CAN_MAJOR= 63CAN_MAJOR= 91# definitions for the hardware target########################################################################## Only AT-CAN-MINI can be compiled for 82c200 or PeliCAN mode.# All other Targets are assuming to have an SJA1000# CPC_PCI implies PeliCAN#### Supported TARGETS= IME_SLIMLINE ATCANMINI_PELICAN CPC_PCI CPC_CARD ## IXXAT_PCI03 PCM3680 PC104_200 SBS_PC7#### compile DigiTec FC-CAN as ATCANMINI_PELICAN###TARGET=IXXAT_PCI03#TARGET=IME_SLIMLINE#TARGET=PCM3680#TARGET=PC104_200#TARGET=CPC_CARD#TARGET=TRM816#TARGET=GENERIC_I82527#TARGET=SBS_PC7#TARGET=AIM104_CAN#TARGET=CPC_PCITARGET=ATCANMINI_PELICANTARGET_MATCHED = false# location of the compiled objects and the final driver moduleOBJDIR = .# Debugging Code within the driver# to use the Debugging option# and the Debugging control via /proc/sys/Can/DbgMask# the Makefile in subdir Can must called with the DEBUG set to# DEBUG=1# else# NODEBUG# doesn't compile any debug code into the driverDEBUG=DEBUG=1DEBUG=NODEBUG# all definitions for compiling the sources# CAN_PORT_IO - use port I/O instead of memory I/O# CAN_INDEXED_PORT_IO - CAN registers adressed by a pair of registers# one is selcting the register the other one does i/O# used eg. on Elan CPUs# CAN4LINUX_PCI# IODEBUG - all register write accesses are logged# CONFIG_TIME_MEASURE=1 - enable Time measurement at parallel port#ifeq "$(TARGET)" "CPC_PCI"# CPC-PCI PeliCAN PCI (only with SJA1000) ------------------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR)\ -DCAN4LINUX_PCI \ -DCAN_SYSCLK=8 #-DIODEBUGTARGET_MATCHED = trueendififeq "$(TARGET)" "ATCANMINI_PELICAN"# AT-CAN-MINI PeliCAN ISA (only with SJA1000) --------------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_PORT_IO \ -DCAN_SYSCLK=8 #-DCONFIG_M586 #-DCONFIG_TIME_MEASURE=1TARGET_MATCHED = trueendififeq "$(TARGET)" "CPC_CARD"# CPC-Card PeliCAN PC-Card (only with SJA1000) -----------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR)\ -DCAN4LINUX_PCCARD \ -DCAN_SYSCLK=8 #-DIODEBUGTARGET_MATCHED = trueendififeq "$(TARGET)" "IXXAT_PCI03"# IXXAT PC-I 03 board ISA (only with SJA1000) ---------------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_SYSCLK=8TARGET_MATCHED = trueendififeq "$(TARGET)" "PCM3680"# Advantech PCM3680 board ISA (only with SJA1000) ----------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_SYSCLK=8TARGET_MATCHED = trueendififeq "$(TARGET)" "TRM816"# TRM816 Onboard CAN-Controller (only with SJA1000) --------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_INDEXED_PORT_IO \ -DCAN_SYSCLK=10TARGET_MATCHED = trueendififeq "$(TARGET)" "PC104_200"# ESD PC104-200-P PC104 board (with SJA1000) ----------------------------# http://www.esd-electronics.com/german/products/CAN/can-pc104-200_e.htmDEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_PORT_IO -DPC104 \ -DCAN_SYSCLK=8TARGET_MATCHED = trueendififeq "$(TARGET)" "IME_SLIMLINE"# I+ME PcSlimline ISA (only with SJA1000) -----------------------------------DEFS = -D$(TARGET) -D$(DEBUG) -DDEFAULT_DEBUG -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_SYSCLK=8TARGET_MATCHED = trueendififeq "$(TARGET)" "GENERIC_I82527"# Generic i82527 cardDEFS = -D$(TARGET) -D$(DEBUG) -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_SYSCLK=8 -DCAN_PORT_IOTARGET_MATCHED = trueendififeq "$(TARGET)" "SBS_PC7"# SBS PC7compact DINrail mounted Industry PC (with i82527)DEFS = -D$(TARGET) -D$(DEBUG) -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_SYSCLK=8 -DCAN_PORT_IOTARGET_MATCHED = trueendififeq "$(TARGET)" "AIM104_CAN"# Arcom AIM104-CAN PC/104 SJA1000DEFS = -D$(TARGET) -D$(DEBUG) -DCan_MAJOR=$(CAN_MAJOR) \ -DCAN_SYSCLK=8 -DCAN_PORT_IO TARGET_MATCHED = trueendififeq "$(LINUXTARGET)" "LINUXOS"#use normal Linux OSLIBS =CAN_MODULE = Can.oPROJECTHOME=$(shell pwd)INSTALLHOME=/usr/srcendif# TARGET=ELIMA selcts the powerpc-linux crosscompiler# which sets defines like PPC, __PPC__, __PPCifeq "$(TARGET)" "ELIMA"CC:= powerpc-linux-gccCFLAGS= -v -s -O9 -fforce-addr -fforce-mem -ffast-math \ -fomit-frame-pointer -funroll-loops \ -DLOOPS=300000 -DTIMES -DHZ=100DDLFLAGS = -I./ddllib -p powerpc-linux-TARGET_MATCHED = trueelseCC:= gccCFLAGS =endif###########################################################################ifneq "$(TARGET_MATCHED)" "true".DEFAULT: all ; @$(MAKE) allall: @echo "You didn't select a supported TARGET" @echo "select one of: ATCANMINI_PELICAN, CPC_PCI, CPC_CARD, IME_SLIMLINE, IXXAT_PCI03, PCM3680," @echo " PC104_200, TRM816, SBS_PC7"else############################################################################ select the compiler toolchain###########################################################################TOOLS=powerpc-linux-gccTOOLS=arm-uclinux-TOOLS=/usr/local/armtools_glibc/bin/arm-uclinux-TOOLS=BOLD = "\033[1m"BOLD = "\033[0;31m"NBOLD = "\033[0m"ECHO = /bin/echo -eCOMPILE = $(ECHO) "--- Compiling "$(BOLD)$<$(NBOLD)" for $(TARGET) on $(LINUXTARGET) ..." ; \ $(TOOLS)gccDEPEND = $(ECHO) "--- Checking dependencies..." ; $(TOOLS)$(CPP)RLINK = $(ECHO) "--- Linking (relocatable) "$(BOLD)$@$(NBOLD)"..." ;\ $(TOOLS)ld -rLINK = $(ECHO) "--- Linking "$(BOLD)$@$(NBOLD)"..." ; $(TOOLS)gccYACC = $(ECHO) --- Running bison on $(BOLD)$<$(NBOLD)...; bison -d -yLEX = $(ECHO) --- Running flex on $(BOLD)$<$(NBOLD)...; flexCC = $(COMPILE)all: $(CAN_MODULE)# !! should be for all Kernels > 2.2.17 ???# for each kernel ther is a set of kernel specific headers in# /lib/modules/`uname -r`/build/include#ifeq "$(LINUXTARGET)" "LINUXOS"ifeq "$(findstring 2.4., $(KVERSION))" "" INCLUDES = -Isrc INCLUDES = -I. TEST = Neinelse INCLUDES = -Isrc -I/lib/modules/`uname -r`/build/include INCLUDES = -I. -I/lib/modules/`uname -r`/build/include #INCLUDES = -Isrc -I/home/geg/kernel/linux-2.4.22-586/include TEST = Jaendifendif# for cross compiling Tollenaar#INCLUDES = -Isrc -I$(KERNEL_SRC)/include# That are the finally used flags for compiling the sourcesCFLAGS = -Wall -D__KERNEL__ -DLINUX -O2 -Wstrict-prototypes -fomit-frame-pointer $(DEFS) $(OPTIONS) $(INCLUDES) -DVERSION=\"$(DVERSION)_$(TARGET)\"VPATH=src# all the files to be compiled into object codeOBJS = \ core.o \ open.o \ read.o \ write.o \ ioctl.o \ select.o \ close.o \ debug.o \ error.o \ util.o \ sysctl.o \ async.o \# include Chip specific object filesifeq "$(TARGET)" "CPC_PCI"OBJS += sja1000funcs.oendififeq "$(TARGET)" "CPC_CARD"OBJS += sja1000funcs.oendififeq "$(TARGET)" "ATCANMINI_PELICAN"OBJS += sja1000funcs.oendififeq "$(TARGET)" "IXXAT_PCI03"OBJS += sja1000funcs.oendififeq "$(TARGET)" "PCM3680"OBJS += sja1000funcs.oendififeq "$(TARGET)" "TRM816"OBJS += sja1000funcs.oendififeq "$(TARGET)" "PC104_200"OBJS += mcf5282funcs.oendififeq "$(TARGET)" "IME_SLIMLINE"OBJS += sja1000funcs.oendififeq "$(TARGET)" "SBS_PC7"OBJS += i82527funcs.oendififeq "$(TARGET)" "GENERIC_I82527"OBJS += i82527funcs.oendififeq "$(TARGET)" "AIM104_CAN"OBJS += sja1000funcs.oendif$(CAN_MODULE): $(addprefix $(OBJDIR)/,$(OBJS)) $(OBJDIR) @$(RLINK) -o $@ $(addprefix $(OBJDIR)/,$(OBJS))$(OBJDIR)/core.o: core.c can4linux.h defs.h @echo "Kernel: $(KVERSION); Test=$(TEST)" @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/open.o: open.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/read.o: read.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/write.o: write.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/ioctl.o: ioctl.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/select.o: select.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/async.o: async.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/close.o: close.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/sja1000funcs.o: sja1000funcs.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/util.o: util.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/sysctl.o: sysctl.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/error.o: error.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/debug.o: debug.c can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<$(OBJDIR)/i82527funcs.o: i82527funcs.c i82527.h can4linux.h defs.h @$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<# load host specific CAN configurationload: $(ECHO) ">>> " Loading Driver Module to Kernel /sbin/insmod $(CAN_MODULE) @echo "Loading etc/$(CONFIG).conf CAN configuration" utils/cansetup etc/$(CONFIG).conf echo 0 >/proc/sys/Can/dbgMask# load host configuration and set dbgMaskdload: $(ECHO) ">>> " Loading Driver Module to Kernel /sbin/insmod $(CAN_MODULE) @echo "Loading etc/$(CONFIG).conf CAN configuration" utils/cansetup etc/$(CONFIG).conf echo 7 >/proc/sys/Can/dbgMask ./debug# unload the CAN driver moduleunload: $(ECHO) ">>> " Removing Driver Module from Kernel -/sbin/rmmod $(CAN_MODULE:.o=).PHONY:examplesexamples: cd ../can4linux-examples; makeclean: -rm -f tags -rm -f $(OBJDIR)/*.o -rm -f Can.o #(cd ../can4linux-examples;make clean)distclean: clean cd examples; make clean cd trm816; make cleaninodes: -mknod /dev/can0 c $(CAN_MAJOR) 0 -mknod /dev/can1 c $(CAN_MAJOR) 1 -mknod /dev/can2 c $(CAN_MAJOR) 2 -mknod /dev/can3 c $(CAN_MAJOR) 3 -mknod /dev/can4 c $(CAN_MAJOR) 4 -mknod /dev/can5 c $(CAN_MAJOR) 5 -mknod /dev/can6 c $(CAN_MAJOR) 6 -mknod /dev/can7 c $(CAN_MAJOR) 7 chmod 666 /dev/can[0-7]ctags: $(CTAGS) *.[ch] /usr/include/linux/pci.h############################################################################# V e r s i o n C o n t r o l############################################################################### commit changes of all files to the cvs repositorycommit: cvs commit -F commitfile# tag all files in the current moduletag: cvs tag $(RELEASE)#### HTML Manual section. #################################man: port_footer.html doxygenshowman: netscape -raise -remote 'openURL(file:$(PROJECTHOME)/man/html/index.html)'# Standardfooter f黵 manual pages sollte irgendwo im pms 00340# stehen, dito das port.gif bild#port_footer.html: Makefile cat ft.html | sed 's/TITLE/$(TITLE)/' \ | sed 's/DATE/$(shell date)/' \ > $@archive: distclean tar zcvf can4linux.$(VERSION).$(REL).tgz -h\ Makefile Doxyfile README* \ INSTALL.t2 INSTALL.pdf INSTALL-g.pdf CHANGELOG \ etc \ man \ src \ obj \ examples \ utils \ ft.html \ debug \ trm816install: -mkdir $(INSTALLHOME)/can4linux -mkdir $(INSTALLHOME)/can4linux/obj (cd $(INSTALLHOME)/can4linux; ln -s $(PROJECTHOME)/etc .) (cd $(INSTALLHOME)/can4linux; ln -s $(PROJECTHOME)/examples .) (cd $(INSTALLHOME)/can4linux; ln -s $(PROJECTHOME)/src .) (cd $(INSTALLHOME)/can4linux; ln -s $(PROJECTHOME)/utils .) cp Makefile debug $(INSTALLHOME)/can4linux (cd $(INSTALLHOME)/can4linux; make)endif# Help Text#### make targets:## Can.o - compile the driver sources to Can.o## examples - compile examples in examples directory## man - manual pages using Doxygen## archive - create a *tgz#### only as super user:## inodes - create device entries in /dev## load - load the driver and use actual "host"-configuration## dload - load with debugMask set to "debug"## unload - unload the CAN driver module#### install - install the driver in /usr/src with references to## this actual source tree.PHONY:helphelp: @echo -e "\nMakefile for the can4linux CAN driver module" @echo "Actual Release Tag is set to RELEASE=$(RELEASE)." @sed -n '/^##/s/^## //p' Makefile
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -