examples/kerneltest/Makefile.in
changeset 391 7802a7d5584f
child 790 1936110171a2
equal deleted inserted replaced
390:31dc4ec8710c 391:7802a7d5584f
       
     1 #! gmake
       
     2 
       
     3 #
       
     4 # Copyright (C) 2006 Laurent Bessard
       
     5 # 
       
     6 # This file is part of canfestival, a library implementing the canopen
       
     7 # stack
       
     8 # 
       
     9 # This library is free software; you can redistribute it and/or
       
    10 # modify it under the terms of the GNU Lesser General Public
       
    11 # License as published by the Free Software Foundation; either
       
    12 # version 2.1 of the License, or (at your option) any later version.
       
    13 # 
       
    14 # This library is distributed in the hope that it will be useful,
       
    15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    17 # Lesser General Public License for more details.
       
    18 # 
       
    19 # You should have received a copy of the GNU Lesser General Public
       
    20 # License along with this library; if not, write to the Free Software
       
    21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    22 # 
       
    23 
       
    24 #ifneq ($(KERNELRELEASE),)
       
    25 # Kbuild part of Makefile
       
    26 TARGET = SUB_TARGET
       
    27 CAN_DRIVER = SUB_CAN_DRIVER
       
    28 TIMERS_DRIVER = SUB_TIMERS_DRIVER
       
    29 
       
    30 EXTRA_CFLAGS := -I$(src)/../../include
       
    31 EXTRA_CFLAGS += -I$(src)/../../include/$(TARGET)
       
    32 EXTRA_CFLAGS += -I$(src)/../../include/$(CAN_DRIVER)
       
    33 EXTRA_CFLAGS += -I$(src)/../../include/$(TIMERS_DRIVER)
       
    34 EXTRA_CFLAGS += SUB_PROG_CFLAGS
       
    35 
       
    36 OBJS := kernel_module.o
       
    37 OBJS += TestSlave.o
       
    38 OBJS += TestMaster.o
       
    39 OBJS += Slave.o
       
    40 OBJS += Master.o
       
    41 OBJS += TestMasterSlave.o
       
    42 
       
    43 obj-m := canf_ktest.o
       
    44 canf_ktest-objs := $(OBJS)
       
    45 
       
    46 #else
       
    47 # Normal Makefile
       
    48 CC = SUB_CC
       
    49 PREFIX = SUB_PREFIX
       
    50 KERNELDIR := SUB_KERNELDIR
       
    51 
       
    52 all: canf_ktest
       
    53 
       
    54 canf_ktest: canf_ktest_console TestSlave.c TestMaster.c
       
    55 	cat ../../drivers/can_virtual_kernel/Module.symvers > Module.symvers
       
    56 	cat ../../src/Module.symvers >> Module.symvers
       
    57 	$(MAKE) -C $(KERNELDIR) M=$(shell pwd) modules
       
    58 
       
    59 clean:
       
    60 	$(MAKE) -C $(KERNELDIR) M=$(shell pwd) clean
       
    61 	rm -f Module.symvers
       
    62 	rm -f console/canf_ktest_console
       
    63 
       
    64 mrproper: clean
       
    65 	rm -f TestSlave.c
       
    66 	rm -f TestMaster.c
       
    67 
       
    68 install:
       
    69 	$(MAKE) -C $(KERNELDIR) M=$(shell pwd) modules_install
       
    70 	mkdir -p $(PREFIX)/bin/
       
    71 	cp console/canf_ktest_console $(PREFIX)/bin/
       
    72 	/bin/sh insert.sh
       
    73 
       
    74 uninstall:
       
    75 	rm -f $(PREFIX)/bin/canf_ktest_console
       
    76 
       
    77 canf_ktest_console: console/console.c console/console.h
       
    78 	$(CC) console/console.c -o console/canf_ktest_console
       
    79 
       
    80 TestSlave.c: TestSlave.od
       
    81 	$(MAKE) -C ../../objdictgen gnosis
       
    82 	python ../../objdictgen/objdictgen.py TestSlave.od TestSlave.c
       
    83 
       
    84 TestMaster.c: TestMaster.od
       
    85 	$(MAKE) -C ../../objdictgen gnosis
       
    86 	python ../../objdictgen/objdictgen.py TestMaster.od TestMaster.c
       
    87 	
       
    88 #endif