master/Makefile
branchstable-1.0
changeset 1621 4bbe090553f7
parent 1619 0d4119024f55
child 1624 9dc190591c0f
equal deleted inserted replaced
1620:9d7453c16ade 1621:4bbe090553f7
    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_master.o
    43 obj-m := ec_master.o
    44 
    44 
    45 ec_master-objs := module.o master.o device.o slave.o command.o types.o \
    45 ec_master-objs := module.o master.o device.o slave.o command.o types.o \
    46 		domain.o mailbox.o canopen.o ethernet.o debug.o fsm.o
    46 		domain.o mailbox.o canopen.o ethernet.o debug.o fsm.o
    47 
    47 
    48 REV := $(shell svnversion $(src) 2>/dev/null)
    48 REV := $(shell svnversion $(src) 2>/dev/null || echo "unknown")
    49 
    49 
    50 EXTRA_CFLAGS := -DSVNREV=$(REV) -DUSER=$(USER)
    50 EXTRA_CFLAGS := -DSVNREV=$(REV) -DUSER=$(USER)
    51 
    51 
    52 #------------------------------------------------------------------------------
    52 #------------------------------------------------------------------------------
       
    53 #  default section
    53 
    54 
    54 else
    55 else
    55 
       
    56 #------------------------------------------------------------------------------
       
    57 #  default section
       
    58 
    56 
    59 ifneq ($(wildcard ../ethercat.conf),)
    57 ifneq ($(wildcard ../ethercat.conf),)
    60 include ../ethercat.conf
    58 include ../ethercat.conf
    61 else
    59 else
    62 KERNEL := $(shell uname -r)
    60 KERNEL := $(shell uname -r)
    63 endif
    61 endif
    64 
    62 
    65 KERNELDIR := /lib/modules/$(KERNEL)/build
    63 KERNEL_DIR := /lib/modules/$(KERNEL)/build
       
    64 CURRENT_DIR := $(shell pwd)
       
    65 INSTALL_MOD_DIR := ethercat/master
    66 
    66 
    67 modules:
    67 modules:
    68 	$(MAKE) -C $(KERNELDIR) M=`pwd`
    68 	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) modules
       
    69 
       
    70 install: modules_install
       
    71 
       
    72 modules_install:
       
    73 	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) \
       
    74 		INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) modules_install
    69 
    75 
    70 clean:
    76 clean:
    71 	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
    77 	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
    72 
    78 
    73 #------------------------------------------------------------------------------
    79 #------------------------------------------------------------------------------
    74 
    80 
    75 endif
    81 endif