#*****************************************************************************
#						Copyright(c) 2010 DTS INSIGHT CORPORATION
# Function : Makefile for building System Macro Trace driver
#
# Modification history
# +-------------- Historical number (000 to 999)
# |	  +--------- Modified System Version
# |	  | 	+--- Classification of New, Modify, Append, Delete
# v	  v 	v
# No  Ver  Class Date	  Name			Description
#---+-----+----+----------+-------------+--------------------------------------
# 000 00.00 New 2011/04/25 K.Ohta		New document
# *****************************************************************************/

#
# Set gcc prefix for a cross compiler.
#
#CROSS_COMPILE=linux-gnu-

#
# Set the kernel directory.
#
#KERNELDIR=/home/smt/kernel/linux
#export CROSS_COMPILE KERNELDIR

#
# Set the driver file name.
#
TARGET= smtModule.ko

#
# Set the driver version.
#
TARGET_VER=2.00

#
#	You don't need to make change hereafter.
#
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
LD = $(CROSS_COMPILE)ld
STRIP = $(CROSS_COMPILE)strip
M=$(shell pwd)


EXTRA_CFLAGS = $(COMMON_CFLAGS) -DDRIVER_VERSION=\"$(TARGET_VER)\"

target := $(notdir $(TARGET))
obj-m  := $(subst .ko,.o,$(target))
$(subst .o,,$(obj-m))-objs := smt.o syscall.o apicore.o smtoutput.o

all: $(target)

$(target): smt.c syscall.c apicore.c smtoutput.c smt.h smtif.h
	$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules
	$(STRIP) --strip-unneeded $@

modules_install:
	$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules_install

clean:
	$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) clean

