#
#                             IPSTB Project
#                   ---------------------------------
#
# Copyright (C) 2009 NXP B.V.,
# All Rights Reserved.
#
# Filename: makefile phStbDFB component
#
#
# Rev Date       Author      Comments
#-------------------------------------------------------------------------------
#   1 20050711 batelaan    Original
#   2 20050713 batelaan    Use dll functionality in sde now.
#   3 20050713 batelaan    Crosscheck fixes
#   4 20050729 mpage       Adding SyncInfo
#   5 20050804 laird       Adding encoder support (anabel/ak4702)
#   6 20050823 charrett    Reorganise code
#   7 20050825 burningh    Moving analogue back end header files
#   8 20050831 laird       Adding non FBdev graphics layers
#   9 20050912 charrett    Include phStbDraw and hw acceleration code
#  10 20050913 laird       Adding FB include path
#  11 20051006 charrett    Use staging dir instead of rootfs
#  12 20051007 charrett    Crosscheck corrections
#---------------------------------------------------------------------------
#  13 20070109 laird       Supporting STB225
#  14 20070116 laird       Crosscheck rework.
#  15 20070118 batelaan    Cope with binary release component.
#  16 20070118 batelaan    Add install dependency.
#  17 20070131 neill       Change initialisation name
#  18 20070807 neill       Ensure phStbDFB is linked with maths library
#  19 20070904 neill       Add requirement on phStbCore
#  20 20071220 laird       Adding support for new DirectFB gfxdriver in the future.
#  21 20080104 laird       More DirectFB 1.1.1 support.
#  22 20080716 laird       Extending DFB1.1.1 support.
# 22.1.3 20081203 legendre Adding uda3000 support
#  22.1.1 20080528 laird   DirectFB headers now in /usr/include.
#  24 20080716 laird       Adding Video layer support and choosing DFB version to compile.
#  25 20080807 laird       Tidy Up.
#25.1.1 20081203 laird     Merged from 'makefile-SOUsb225#25:makefile:ipstb#79' and 'makefile-CFR_STB#22.1.3:makefile:ipstb#79' by laird.
#  26 20090119 batelaan    Add phStbStreamingSystem to REQUIRED for DFB 1.0
#  27 20090312 batelaan    fb.modes moved into src/rootfs/etc as not exclusively used by DFB.
#  28 20090318 laird       Update DLL flags for init, fini addresses.
#---------------------------------------------------------------------------

DIR_LOCAL       = comps/phStbDFB

#***********************************************************************
# Do not change the following include
#***********************************************************************
include $(_TMROOT)/sde/environment.mk

DIRECTFB_INSTALL_SUBDIR = gfxdrivers
include ../phStbDFB/directfb_libinstall.mk

ifeq ($(_TMTGTCPUCLASS),mips)

#-----------------------------------------------------------------------
# Source environment variables
#-----------------------------------------------------------------------
# Are we the DirectFB 1.0 driver?
ifndef CONFIG_DIRECTFB_VERSION_1_2_X
C_SOURCES = \
  src/1.0/phStbDFB_Init.c \
  src/1.0/phStbDFB_Screen.c \
  src/1.0/phStbDFB_Encoder.c \
  src/1.0/phStbDFB_Mixer.c \
  src/1.0/phStbDFB_Utils.c \
  src/1.0/phStbDFB_Layers.c \
  src/1.0/phStbDFB_FBDevGfxLayer.c \
  src/1.0/phStbDFB_VidLayer.c \
  src/1.0/phStbDFB_HWAccel.c

DIR_INCLUDE += src/1.0

LOCAL_CFLAGS += -DDIRECTFB_1_0

else
# We are the new DirectFB 1.2 driver
C_SOURCES = \
  src/phStbDFB_gfxdriver.c \
  src/phStbDFB_2d.c        \
  src/phStbDFB_screen.c    \
  src/phStbDFB_gfx_pool.c  \
  src/phStbDFB_gfx.c       \
  src/phStbDFB_mixer.c     \
  src/phStbDFB_output.c    \
  src/phStbDFB_encoder.c   \
  src/phStbDFB_utils.c     \
  src/phStbDFB_video_pool.c \
  src/phStbDFB_video.c      \

endif

#-----------------------------------------------------------------------
# Required components
#-----------------------------------------------------------------------
# Common:
REQUIRES = \
  IphStbCommon \
  phStbDbg \
  phStbVideoRenderer \
  IphStbVideoTypes \
  phStbDraw \
  phStbFB \
  $(if CONFIG_SCART_AK470X, ak470x) \
  $(if CONFIG_SCART_UDA3000, uda3000) \
  phStbCore \

ifndef CONFIG_DIRECTFB_VERSION_1_2_X
  REQUIRES += \
    phStbStreamingSystem
endif

LIBS = \
  phStbVideoRenderer \
  phStbDbg \

#-----------------------------------------------------------------------
# Flags
#-----------------------------------------------------------------------

EXPORTS=true

DIR_INCLUDE += \
  $(KSRC)/include \
  $(STAGINGDIR)/opt/nxp/include \
  $(STAGINGDIR)/usr/include \
  $(STAGINGDIR)/usr/include/directfb \
  $(STAGINGDIR)/usr/include/directfb-internal

LOCAL_CFLAGS += -D_GNU_SOURCE

# Ensure that directfb_STB225() is called when the shared object file is loaded by DirectFB:
# With DiretFB1.2.x we can also specify the destructor to make sure it is unloaded.
ifndef CONFIG_DIRECTFB_VERSION_1_2_X
LOCAL_DLLFLAGS = -init directfb_STB225
else
LOCAL_DLLFLAGS = -init directfb_STB225_ctor -fini directfb_STB225_dtor
endif

LOCAL_DLLFLAGS += -L$(ROOTFS)/usr/lib -ldirectfb -ldirect -lfusion -lpthread -lm

# We don't want all the warnings about the DirectFB include files.
_TMTGTWARNINGS := 2

#-----------------------------------------------------------------------
# Do not change this
#-----------------------------------------------------------------------
all: configuration lib install

ifneq ($(DIR_CONFIG),_)
include $(DIR_SDE)/$(DIR_CONFIG)/makelib.mk
endif

else
$(warning phStbDFB is only meant for MIPS/Linux)
.DEFAULT:
	@true
endif

