###############################################################################
# Makefile for P2P test framework library
#
# Copyright 2007 BroadOn Communications Corp.  All rights reserved.
#
###############################################################################

USES_RM = 0

include ../../../../devroot/include/make/SDKdefs
include ../share/libraries_common.mk

SRCDIR = $(GBA_SOURCE)/sw/common/lib/p2p/test/framework

# commondefs must be included near the top so that all common variables
# will be defined before their use.
include $(GBA_SOURCE)/sw/common/lib/p2p/test/framework/Make.common

# module name should be set to the name of this subdirectory
MODULENAME	= p2p_testframework

# This indicates to commondefs/modulerules as to where this directory is
# The selectable paths are restricted to limit the number of subtrees
# that are added to the SDK tree.
LIB		= TRUE

# Library building
# LIBNAME specifies the name of the library.  No suffix is required, as
# that will depend on whether this is a DEBUG build or not.
# The final name of the library will be $(LIBNAME)$(LIBSUFFIX)
LIBNAME		= p2p_testframework

# CLIBSRCS/CPPLIBSRCS specifies all C/C++ files that are built and linked into 
# the library.
# ASMLIBSRCS are all assembly files that will be built and linked into the lib.
CLIBSRCS       = \
		 $(CFILES)  \

# ends up being BUILD_ROOT, the core of MODULE_ROOT
REX_BUILDDIR = ../..

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

CCFLAGS_WARNING = -W padding,nounused

INCLUDES += \
	    -I$(P2P_INC_ROOT) \
	    -I$(P2P_PRIV_INC_ROOT) 

setup:	
	@if [ -z '$(REVOLUTION_P2P_ROOT)' ]; then\
	    echo "You must establish environment variable REVOLUTION_P2P_ROOT before proceeding."; \
	    exit 1; \
	fi
	@if [ ! -w '$(REVOLUTION_P2P_ROOT)' -o ! -d '$(REVOLUTION_P2P_ROOT)' ]; then\
	    mkdir -p '$(REVOLUTION_P2P_ROOT)'; \
	fi
# $(SETUP_ROOTS) does not create directory $(DEP_ROOT), without which build will fail
	@mkdir -p $(DEP_ROOT)

P2P_TEST_HFILES=p2p_testcfg.h
P2P_TEST_FRAMEWORK_HFILES={p2p_test_framework.h,p2p_test_setup.h,p2p_test_environment.h,p2p_test_porting.h,p2p_test_print.h,p2p_test_invariant.h,p2p_test_cases.h,p2p_nts_config.h}

P2P_SHARE_HFILES={p2p_serialization.h,shr_trace.h,shr_types.h}
P2P_PRIV_SHARE_HFILES={shr_plat.h,shr_th.h,shr_mem.h,shr_getopt.h,shr_trace_i.h,shr_time.h,shr_lib.h}

headers:
	@if [ ! -w $(P2P_INC_ROOT) -o ! -d $(P2P_INC_ROOT) ]; then \
	    	mkdir -p $(P2P_INC_ROOT); \
	fi
	$(INSTALL) -p $(GBA_SOURCE)/sw/common/lib/p2p/share/$(P2P_SHARE_HFILES) $(P2P_INC_ROOT)
	$(INSTALL) -p $(GBA_SOURCE)/sw/common/lib/p2p/share/$(P2P_PRIV_SHARE_HFILES) $(P2P_PRIV_INC_ROOT)
	$(INSTALL) -p $(GBA_SOURCE)/sw/common/lib/p2p/test/$(P2P_TEST_HFILES) $(P2P_INC_ROOT)
	$(INSTALL) -p $(GBA_SOURCE)/sw/common/lib/p2p/test/framework/$(P2P_TEST_FRAMEWORK_HFILES) $(P2P_INC_ROOT)
