###############################################################################
# Makefile for SO demos
#
# Copyright 2002 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.
#
# $Log: makefile,v $
# Revision 1.1  2005/12/20 20:42:32  horti
# Added some networking files.
#
#   
#   4     04/10/15 16:03 Ueno_kyu
#   Removed ping.
#   
#   3     7/29/04 15:26 Shiki
#   Added ping.
#   
#   2     04/03/08 20:51 Ueno_kyu
#   Added netcfg demo.
#   
#   1     10/17/02 14:10 Shiki
#   Initial check-in.
# $NoKeywords: $
#
###############################################################################

##################################
# QUICK START INSTRUCTIONS
# Type "make" at /dolphin/build/demos/osdemo to build DEBUG versions 
# of all demos
# Type "make NDEBUG=TRUE" to build OPTIMIZED versions of all tests
# Type "make stopwatchdemoD.bin" to build DEBUG version of just stopwatchdemo
# Type "make NDEBUG=TRUE stopwatchdemo.bin" to build OPTIMIZED version of 
# just stopwatchdemo
#
# To add another demo
# 1. add the .c files to CSRCS to make sure they are built
# 2. add the binary name (no suffix) to BINNAMES
# 3. add a dependency rule for this executable at the bottom of this file
##################################


# 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 (/dolphin/$(ARCH_TARGET)).
all: 	setup build install

# commondefs must be included near the top so that all common variables
# will be defined before their use.
include $(BUILDTOOLS_ROOT)/commondefs

# following libraries are required to use the socket API.
DOLPHINLIBS += $(INSTALL_ROOT)/lib/ip$(LIBSUFFIX) \
               $(INSTALL_ROOT)/lib/eth$(LIBSUFFIX) \
               $(INSTALL_ROOT)/lib/netcfg$(LIBSUFFIX)

# module name should be set to the name of this subdirectory
# DEMO = TRUE indicates that this module resides under the "demos" subtree.
# The list of selectable paths can be found in modulerules.
MODULENAME	= sodemo
DEMO		= TRUE

# 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)
BINNAMES 	= dhcp pppoe host httpd netcfg

# CSRCS lists all C 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
CSRCS		= dhcp.c pppoe.c host.c
CSRCS	       += httpdmain.c httpd.c
CSRCS	       += netcfg.c card.c

# defining a linker command file will have the build system generate it
# automatically and include it on the linker invocation line
LCF_FILE	= $(INC_ROOT)/dolphin/eppc.$(ARCH_TARGET).lcf

# modulerules contains the rules that will use the above variables 
# and dependencies below to construct the binaries specified.
include $(BUILDTOOLS_ROOT)/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
# $(DOLPHINLIBS) includes all the Dolphin libraries.

$(FULLBIN_ROOT)/dhcp$(BINSUFFIX):  dhcp.o $(DOLPHINLIBS)

$(FULLBIN_ROOT)/pppoe$(BINSUFFIX): pppoe.o $(DOLPHINLIBS)

$(FULLBIN_ROOT)/host$(BINSUFFIX): host.o $(DOLPHINLIBS)

$(FULLBIN_ROOT)/httpd$(BINSUFFIX): httpdmain.o httpd.o $(DOLPHINLIBS)

$(FULLBIN_ROOT)/netcfg$(BINSUFFIX): card.o netcfg.o $(DOLPHINLIBS)
