]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/Makefile
Structured comments updated.
[lincan.git] / lincan / Makefile
index 75a118260631c8947e2703e60cb9d11d9a1d208d..f595272447ee336c2773b8736d60ee6e88cf5189 100644 (file)
-# 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
+# Generic directory or leaf node makefile for OCERA make framework
 
-########## The following options can be changed ##########
-
-# Include directory
-INCLUDEDIR = /usr/src/linux/include
-# Compiler
-CC = gcc
-# Enable debugging messages
-DEBUG = y 
-# Enable module version support
-MODVERSIONS = 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.
-PIP = y
-PCCAN = y      # Not to be confused with PCCCAN!!!
-SMARTCAN = y
-NSI = y
-CC104 = y
-AIM104 = y
-PCI03 = y
-PCM3680 = y
-M437 = y
-PCCCAN = y     # Not to be confused with PCCAN!!!
-SSV = y
-TEMPLATE = y
-
-########## Don't change anything under this line please ##########
-
-KERNEL_VERSION := $(shell awk -F\" '/REL/ {print $$2}' \
-       $(INCLUDEDIR)/linux/version.h | awk -F\- '{print $$1}')
-
-PROC_FS := $(shell awk -F\  '/PROC_FS/ {print $$3}' \
-       $(INCLUDEDIR)/linux/autoconf.h)
-
-VPATH = ./src:./include:./utils
-
-CFLAGS = -D__KERNEL__ -DMODULE -O2 -Wall -Wstrict-prototypes \
-       -Wpointer-arith -I $(INCLUDEDIR)
-       
-
-ifdef DEBUG
-       CFLAGS += -DCAN_DEBUG
-endif
-
-ifndef MODVERSIONS
-       CFLAGS += -DNOVER
+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
 
-ifdef PROC_FS
-       SRCS += proc.c
-       OBJS += proc.o
-endif
-ifdef PIP
-       SRCS += pip.c
-       OBJS += pip.o
-endif
-ifdef PCCAN
-       SRCS += pccan.c
-       OBJS += pccan.o
-endif
-ifdef SMARTCAN
-       SRCS += smartcan.c
-       OBJS += smartcan.o
-endif
-ifdef NSI
-       SRCS += nsi.c
-       OBJS += nsi.o
-endif
-ifdef CC104
-       SRCS += cc_can104.c
-       OBJS += cc_can104.o
-endif
-ifdef PCI03
-       SRCS += pc-i03.c
-       OBJS += pc-i03.o
-endif
-ifdef PCM3680
-       SRCS += pcm3680.c
-       OBJS += pcm3680.o
-endif
-ifdef AIM104
-       SRCS += aim104.c
-       OBJS += aim104.o
+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
-ifdef M437
-       SRCS += m437.c
-       OBJS += m437.o
-endif
-ifdef PCCCAN
-       SRCS += pcccan.c
-       OBJS += pcccan.o
-endif
-ifdef SSV
-       SRCS += ssv.c
-       OBJS += ssv.o
-endif
-ifdef TEMPLATE
-       SRCS += template.c
-       OBJS += template.o
-endif
-
-SRCS += main.c modparms.c setup.c sja1000.c i82527.c close.c ioctl.c\
-       open.c write.c read.c sja1000p.c irq.c
-
-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
-
-all : mesg main.ver can.o utils
-
-mesg :
-       @echo
-       @echo Compiling for kernel version: $(KERNEL_VERSION)
-ifdef MODVERSIONS
-       @echo Compiling with module version support
-else
-       @echo Compiling without module version support
-endif
-ifdef PROC_FS
-       @echo Compiling with proc filesystem support
-else
-       @echo Compiling without proc filesystem support
-endif
-       @echo
-
-ifdef MODVERSIONS
-main.ver : main.c
-       $(CC) -I $(INCLUDEDIR) -E -O2 -D__GENKSYMS__ $^ | \
-       /sbin/genksyms -k $(KERNEL_VERSION) > ./include/$@
-else
-main.ver:
-endif
-
-can.o : $(OBJS)
-       (cd ./src; ld -o ../can.o $(OBJS) -E -O2 -r)
-
-main.o : main.c main.h proc.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-proc.o : proc.c main.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-modparms.o : modparms.c modparms.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-setup.o : setup.c setup.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-pip.o : pip.c pip.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define PIP 1" >> .support
-pccan.o : pccan.c pccan.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define PCCAN 1" >> .support
-smartcan.o : smartcan.c smartcan.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define SMARTCAN 1" >> .support
-nsi.o : nsi.c nsi.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define NSI 1" >> .support
-cc_can104.o : cc_can104.c cc_can104.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define CC104 1" >> .support
-aim104.o : aim104.c aim104.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define AIM104 1" >> .support
-pc-i03.o : pc-i03.c pc-i03.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define PCI03 1" >> .support
-pcm3680.o : pcm3680.c pcm3680.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define PCM3680 1" >> .support
-m437.o : m437.c m437.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define M437 1" >> .support
-pcccan.o : pcccan.c pcccan.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define PCCCAN 1" >> .support
-ssv.o : ssv.c ssv.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define SSV 1" >> .support
-template.o : template.c template.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-       @echo "#define TEMPLATE 1" >> .support
-open.o : open.c open.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-i82527.o : i82527.c i82527.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-close.o : close.c close.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-read.o : read.c read.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-irq.o : irq.c irq.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-ioctl.o : ioctl.c ioctl.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-write.o : write.c write.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-sja1000.o : sja1000.c sja1000.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-sja1000p.o : sja1000p.c sja1000p.h
-       $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
-
-utils : rxtx sendburst readburst
-
-rxtx : rxtx.c
-       $(CC) -o $(<D)/$@ $< -Wall
-sendburst : sendburst.c
-       $(CC) -o $(<D)/$@ $< -Wall
-readburst : readburst.c
-       $(CC) -o $(<D)/$@ $< -Wall
-
 
-clean :
-       rm -f *.o
-       rm -f .support
-       (cd src; rm -f *.o)
-       (cd include; rm -f *.ver)
-       (cd utils; rm -f rxtx sendburst readburst)