#!/usr/bin/env omake
#----------------------------------------------------------------------------
# Project:  NintendoWare
#
# Copyright (C)Nintendo/HAL Laboratory, Inc.  All rights reserved.
#
# These coded instructions, statements, and computer programs contain proprietary
# information of Nintendo and/or its licensed developers and are protected by
# national and international copyright laws. They may not be disclosed to third
# parties or copied or duplicated in any form, in whole or in part, without the
# prior written consent of Nintendo.
#
# The content herein is highly confidential and should be handled accordingly.
#----------------------------------------------------------------------------

# NintendoWare version check
NW_VERSION_MAJOR=2

if $(test -f $(NW4C_ROOT)/build/omake/version.om)
    include $(NW4C_ROOT)/build/omake/version
    export

SUPPORTED_TARGETS   =   CTR-*.Process.MPCore.*

TARGET_PROGRAM      =   nw4cPlayback
ROM_SPEC_FILE       =   nw4cPlayback.rsf
TITLE               =   nw4cPlayback

SOURCES[]           =
                        MemoryManager.cpp
                        main.cpp

INCLUDES            +=  ./                        
INCLUDES            +=  $(CTRMW_MOBICLIP_ROOT)/include/mw/mo
INCLUDES            +=  $(CTRMW_MOBICLIP_ROOT)/sampledemos/helper

if $(not $(equal $(NW_VERSION_MAJOR), 2))
    NW_LIBRARIES[] +=        
                        nw_dev
else                        
    NW_LIBRARIES[] +=    
                        libnw_dev                    
                    
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_MoflexDemuxer)
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_MobiclipVideoDecoder)
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_ImaAdpcmAudioDecoder)
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_DspAdpcmAudioDecoder)
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_FastAudioDecoder)
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_FilterDeblocker)
LIBFILES            += $`(addprefix $(CTRMW_MOBICLIP_ROOT)$(DIRSEP)sampledemos$(DIRSEP)helper$(DIRSEP)libraries$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), libmw_mo_helper)

SHADER_SOURCES[]    =
                        $(CTRMW_MOBICLIP_ROOT)/sampledemos/helper/helper_VShader.vsh
                        
TARGET_SHADER       =   helper_VShader

SHBIN_INSTALL_ROOT  =   $(CTRMW_MOBICLIP_ROOT)/resources/moflex_videos
   
DEBUG_PRINT = 1

CCFLAGS            +=   -DNW_PROFILE_ENABLED -DNW_VERSION_MAJOR=$(NW_VERSION_MAJOR)

FONTCONV    = $(NW4C_ROOT)/font2/tool/FontConverter/NW_FontConverterConsole.exe
FONTFORMAT  = bffnt

if $(equal $(NW_VERSION_MAJOR), 2)
    FONTCONV = $(NW4C_ROOT)/tools/FontConverter/NW4C_FontConverterConsole.exe
    FONTFORMAT=bcfnt
    export

MakeFont(font, option) =
    $(font): $(FONTCONV) :value: $(option)
        mkdir -p $(dirname $@)
        $(FONTCONV) $(option) -of $@
    return $(font)

FONTS[] =
    $(MakeFont $(SHBIN_INSTALL_ROOT)/font.$(FONTFORMAT), -o $(FONTFORMAT) -i win -in Tahoma -is 12 -ic A4)
    
ROMFS_DEPENDENCIES = $(FONTS)    

include $(NW4C_ROOT)/build/omake/modulerules

build: $(DEFAULT_TARGETS)

DefineDefaultRules()
