##############################################################################
#  
#    Copyright (C) 2005 - 2010 by Vivante Corp.
#  
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public Lisence as published by
#    the Free Software Foundation; either version 2 of the license, or
#    (at your option) any later version.
#  
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#    GNU General Public Lisence for more details.
#  
#    You should have received a copy of the GNU General Public License
#    along with this program; if not write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#  
##############################################################################



#
# This file is a part of Vivante software stack build environment for Linux.
# It defines the rules necessary to build Linux kernel HAL driver. This file
# is included from within the system makefile; here we need to define what
# needs to be build for our driver.
#


################################################################################
# Set the kernel driver flag.

VIVANTE_KERNEL = 1


################################################################################
# Include common definitions.

include $(AQROOT)/GNUmakefile.common


################################################################################
# Define Vivante library directories.

ARCH_LIB_DIR = ../../../../arch/$(notdir $(AQARCH))/hal/kernel/$(OBJ_DIR)
ROOT_LIB_DIR = ../../../kernel/$(OBJ_DIR)


################################################################################
# Describe object files.

OBJECTS = ./Driver.o \
          ./Device.o \
          ./Debug.o \
          ./Kernel.o \
          ./Os.o


################################################################################
# Add extra flags for object files.

EXTRA_CFLAGS += -DLINUX -DDRIVER

ifeq ($(DEBUG), 1)
	EXTRA_CFLAGS += -DDBG=1 -DDEBUG -D_DEBUG
else
	EXTRA_CFLAGS += -DDBG=0
endif

EXTRA_CFLAGS += -I$(AQROOT)/hal/inc
EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel
EXTRA_CFLAGS += -I$(AQARCH)/hal/kernel
EXTRA_CFLAGS += -I$(AQARCH)/cmodel/inc


################################################################################
# Define the target output.

obj-m = $(OBJ_DIR)/GALCore.o

$(OBJ_DIR)/GALCore-objs  = $(OBJECTS)
$(OBJ_DIR)/GALCore-objs += $(ARCH_LIB_DIR)/libHALArchKernel.a
$(OBJ_DIR)/GALCore-objs += $(ROOT_LIB_DIR)/libHALKernel.a
