#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#

#
# @(#)Makefile	1.8 02/01/12
#

# Makefile for building a set of passed in Service tests in a standalone appclient

all:	all2

include $(CTS_HOME)/build/Defs.mk

PACKAGE=com.sun.cts.harness.vehicle.appclient

PKG_DIR=$(shell `mkdir -p $(COMPILE_DIR)$(SLASH)com$(SLASH)sun$(SLASH)cts$(SLASH)harness$(SLASH)vehicle$(SLASH)appclient > $(CTS_HOME)/dev/null`; echo "com$(SLASH)sun$(SLASH)cts$(SLASH)harness$(SLASH)vehicle$(SLASH)appclient";)

SRC_DIR=$(CTS_HOME)$(SLASH)common$(SLASH)harness$(SLASH)vehicle$(SLASH)appclient

FULLCLIENT=$(FULLCLIENT)

#The sevice test can provide a props file in the test dir else you get the 
#default in the appclient_vehicle dir.
XML:=$(shell if [ -f $(SRC_DIR)$(SLASH)appclient.cprops ];then echo "appclient.xml"; else echo "vehicle.xml"; fi )

CLASS_DIR=$(COMPILE_DIR)$(SLASH)$(PKG_DIR)


APP_NAME=$(TESTNAME)_appclient_vehicle
APP_EAR=$(APP_NAME).ear

#Adds test components (if there are any) that need to be packaged with 
#the vehicle
#ifneq ($(APP_COMP_TYPE), )
COMP_TYPE=APPCLIENT $(APP_COMP_TYPE)
#endif

APPCLIENT_CLASSES=$(TEST_CLASSES)

include $(CTS_HOME)/build/BuildRules.mk

all2: all_classes all_xml $(APP_EAR)

# generate all of the class files
all_classes: all_classescommon

#### XML Conversion
all_xml: remove_old_xml all_xmlcommon $(XML)

remove_old_xml:
	rm -rf $(CLASS_DIR)$(SLASH)*.xml


	
#### CREATE APPLICATION JAR
$(APP_EAR): create_unique_names app_clientcommon  
	$(PACKAGE_APP)

create_unique_names:
	sed -e 's/display-name>appclient_vehicle_client/display-name>$(APP_NAME)_client/' $(CLASS_DIR)$(SLASH)$(APP_NAME).xml > \
		$(CLASS_DIR)$(SLASH)$(APP_NAME).xml.tmp; \
	mv -f $(CLASS_DIR)$(SLASH)$(APP_NAME).xml.tmp \
		$(CLASS_DIR)$(SLASH)$(APP_NAME).xml;


VEHICLE="-vehicle appclient"

runclient:
	cd $(SRC_DIR); $(MAKE) runclient2 COMP_TYPE=APPCLIENT APP_NAME=$(APP_NAME) VEHICLE=$(VEHICLE) PKG_DIR=$(PKG_DIR); cd $(CWD);
	
deploy: deploycommon

undeploy: undeploycommon

# Note: for clean to work, ejbd must be stopped and restarted
clean:	cleancommon 


