#
#  Copyright 2006 - 2012 Hannes Holtzhausen
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

#
# $Id: Makefile,v 1.6 2007/11/01 22:53:15 hannes Exp $
#
# Description: 
#   Makefile to build simple.war file.
#

DIST_DIR=dist
WEB_INF_DIR=$(DIST_DIR)/WEB-INF
LIB_DIR=$(WEB_INF_DIR)/lib
ETC_DIR=$(WEB_INF_DIR)/etc
HT_DIR=$(DIST_DIR)/htdocs
JSP_DIR=$(HT_DIR)/jsp

WAR_FILE=simple.war

WEB_XML=etc/web.xml
ETC_FILES=etc/*.xml
HT_FILES=htdocs/*.* 
JSP_FILES=htdocs/jsp/*.*

SIMPLE_JAR=java/simple.jar
TOOLBOX_JAR=$(TOOLBOX_HOME)/lib/toolbox_web.jar

#
# Targets
#
all:
	mkdir $(DIST_DIR)
	mkdir $(WEB_INF_DIR)
	mkdir $(LIB_DIR)
	mkdir $(ETC_DIR)
	mkdir $(HT_DIR)
	mkdir $(JSP_DIR)
	cp $(ETC_FILES) $(ETC_DIR)
	cp $(WEB_XML) $(WEB_INF_DIR)
	rm $(ETC_DIR)/web.xml
	cp $(HT_FILES) $(HT_DIR)
	cp $(JSP_FILES) $(JSP_DIR)
	cp $(SIMPLE_JAR) $(LIB_DIR)
	cp $(TOOLBOX_JAR) $(LIB_DIR)
	cd $(DIST_DIR); jar cfv $(WAR_FILE) *
	mv $(DIST_DIR)/$(WAR_FILE) .

clean:
	rm -r $(DIST_DIR)
	rm $(WAR_FILE)
