# Makefile for USB Microphone Samples
#
# Copyright (c) 2007 Logitech. All rights reserved
#
# Based on the template makefile with the copyright statement below:
#
###############################################################################
# Template makefile for new modules
#
# Copyright (C) 2005-2006 Nintendo.  All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law.  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.
###############################################################################

include ../../../../devroot/include/make/SDKdefs

###############################################################################
# commondefs must be included near the top so that all common variables
# will be defined before their use.
###############################################################################

include $(REVOLUTION_SDK_ROOT)/build/buildtools/commondefs
include $(GBA_SOURCE)/sw/bw/build/buildtools/commondefs

###############################################################################
# The following defines force the commondef defines to be directory independent
###############################################################################

MODULENAME	=
MODULE_ROOT	= .
DEMO	 	= TRUE
DEMO_ROOT	= .
SAMPLE	 	=
LINCLUDES	= -Iinclude
LINCLUDES       += -Iusbmic/include

###############################################################################
# Binary building
# BINNAMES lists all binaries that will be linked.  Note that no suffix is
# required, as that will depend on whether this is a DEBUG build or not.
# The final name of the binaries will be $(BINNAME)$(BINSUFFIX)
#
# CSRCS lists all C files that should be built
# ASMSRCS lists all assembly files that should be built.
# The makefile determines which objects are linked into which binaries
# based on the dependencies you fill in at the bottom of this file
###############################################################################

BINNAMES	+= linkability simple_streaming
CSRCS		+= linkability.c simple_streaming.c
BINNAMES	+= simple_streaming
CSRCS		+= simple_streaming.c
BINNAMES	+= recfile
CPPSRCS		+= recfile.cpp hio2wrapper.cpp
BINNAMES	+= multimic
CPPSRCS		+= multimic.cpp
BINNAMES	+= loopback
CPPSRCS		+= loopback.cpp aiwrapper.cpp
ASMSRCS		=

# we're in 2007, C99 was 8 years ago...
CCFLAGS     += -dialect c99
# the gcc style errors looks much more sane than the default
COMPILER_MSG_STYLE ?= gcc
CCFLAGS     += -msgstyle $(COMPILER_MSG_STYLE)

###############################################################################
# All modules have "setup" and "build" as targets.  System libraries
# and demo programs also have an "install" target that copies the compiled
# binaries to the binary tree (/revolution/$(ARCH_TARGET)).
###############################################################################

all: 	setup build

###############################################################################
# Include LCF file
###############################################################################
ifdef EPPC
LCF_FILE =  $(INC_ROOT)/revolution/eppc.$(ARCH_TARGET).lcf
endif

###############################################################################
# modulerules contains the rules that will use the above variables
# and dependencies below to construct the library and binaries specified.
###############################################################################
include $(REVOLUTION_SDK_ROOT)/build/buildtools/modulerules

###############################################################################
# Dependencies for the binaries listed in BINNAMES should come here
# They are your typical makefile rule, with extra variables to ensure
# that the names and paths match up.
# $(FULLBIN_ROOT) is the location of the local bin directory
# $(BINSUFFIX) depends on whether this is a debug build or not
# $(LOCALLIB_ROOT) points at the local lib directory
# $(REVOLUTION_LIBS) includes all the Revolution libraries.
###############################################################################
$(FULLBIN_ROOT)/linkability$(BINSUFFIX): linkability.o \
				./usbmic/lib/$(ARCH_TARGET)/usbmic$(LIBSUFFIX) \
				$(REVOLUTION_LIBS)

$(FULLBIN_ROOT)/simple_streaming$(BINSUFFIX): simple_streaming.o \
				./usbmic/lib/$(ARCH_TARGET)/usbmic$(LIBSUFFIX) \
				$(REVOLUTION_LIBS)

$(FULLBIN_ROOT)/recfile$(BINSUFFIX): recfile.o hio2wrapper.o \
				./usbmic/lib/$(ARCH_TARGET)/usbmic$(LIBSUFFIX) \
				$(REVOLUTION_LIBS)

$(FULLBIN_ROOT)/multimic$(BINSUFFIX): multimic.o \
				./usbmic/lib/$(ARCH_TARGET)/usbmic$(LIBSUFFIX) \
				$(REVOLUTION_LIBS)

$(FULLBIN_ROOT)/loopback$(BINSUFFIX): loopback.o aiwrapper.o \
				./usbmic/lib/$(ARCH_TARGET)/usbmic$(LIBSUFFIX) \
				$(REVOLUTION_LIBS)
