devices/Makefile
branchstable-1.0
changeset 1621 4bbe090553f7
parent 1619 0d4119024f55
child 1624 9dc190591c0f
equal deleted inserted replaced
1620:9d7453c16ade 1621:4bbe090553f7
     1 #------------------------------------------------------------------------------
     1 #------------------------------------------------------------------------------
     2 #
     2 #
     3 #  kbuild Makefile
     3 #  Makefile
     4 #
     4 #
     5 #  IgH EtherCAT master device modules
     5 #  IgH EtherCAT master device modules
     6 #
     6 #
     7 #  $Id$
     7 #  $Id$
     8 #
     8 #
    33 #  standard) as the (only) precondition to have the right to use EtherCAT
    33 #  standard) as the (only) precondition to have the right to use EtherCAT
    34 #  Technology, IP and trade marks.
    34 #  Technology, IP and trade marks.
    35 #
    35 #
    36 #------------------------------------------------------------------------------
    36 #------------------------------------------------------------------------------
    37 
    37 
    38 ifneq ($(KERNELRELEASE),)
       
    39 
       
    40 #------------------------------------------------------------------------------
    38 #------------------------------------------------------------------------------
    41 #  kbuild section
    39 #  kbuild section
       
    40 
       
    41 ifneq ($(KERNELRELEASE),)
    42 
    42 
    43 obj-m := ec_8139too.o
    43 obj-m := ec_8139too.o
    44 
    44 
    45 ec_8139too-objs := 8139too.o
    45 ec_8139too-objs := 8139too.o
    46 
    46 
    47 REV := $(shell svnversion $(src) 2>/dev/null)
    47 REV := $(shell svnversion $(src) 2>/dev/null || echo "unknown")
    48 
    48 
    49 EXTRA_CFLAGS = -DEC_REV=$(REV) -DEC_USER=$(USER)
    49 EXTRA_CFLAGS = -DEC_REV=$(REV) -DEC_USER=$(USER)
    50 
    50 
    51 #------------------------------------------------------------------------------
    51 #------------------------------------------------------------------------------
       
    52 #  default section
    52 
    53 
    53 else
    54 else
    54 
       
    55 #------------------------------------------------------------------------------
       
    56 #  default section
       
    57 
    55 
    58 ifneq ($(wildcard ../ethercat.conf),)
    56 ifneq ($(wildcard ../ethercat.conf),)
    59 include ../ethercat.conf
    57 include ../ethercat.conf
    60 else
    58 else
    61 KERNEL := $(shell uname -r)
    59 KERNEL := $(shell uname -r)
    62 endif
    60 endif
    63 
    61 
    64 KERNELDIR := /lib/modules/$(KERNEL)/build
    62 KERNEL_DIR := /lib/modules/$(KERNEL)/build
       
    63 CURRENT_DIR := $(shell pwd)
       
    64 INSTALL_MOD_DIR := ethercat/devices
    65 
    65 
    66 modules:
    66 modules:
    67 	$(MAKE) -C $(KERNELDIR) M=`pwd`
    67 	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) modules
       
    68 
       
    69 install: modules_install
       
    70 
       
    71 modules_install:
       
    72 	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) \
       
    73 		INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) modules_install
    68 
    74 
    69 clean:
    75 clean:
    70 	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
    76 	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
    71 
    77 
    72 #------------------------------------------------------------------------------
    78 #------------------------------------------------------------------------------
    73 
    79 
    74 endif
    80 endif