# 
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (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.mozilla.org/MPL/
# 
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
# 
# The Original Code is State Machine Compiler (SMC).
# 
# The Initial Developer of the Original Code is Charles W. Rapp.
# Portions created by Charles W. Rapp are
# Copyright (C) 2000 - 2004. Charles W. Rapp.
# All Rights Reserved.
# 
# Contributor(s):
#
# RCS ID
# $Id: Makefile,v 1.6 2005/06/08 11:09:13 cwrapp Exp $
#
# CHANGE LOG
# (See the bottom of this file.)
#

#################################################################
# Macros.
#

TARGET=		telephone.jar

SM_SOURCES=	Telephone.sm

SOURCES=	$(SM_SOURCES:%.sm=%Context.java) \
		Telephone.java

PACKAGE_DIR=	smc_ex7
SOUND_DIR=	./sounds
FSM_LIB_DIR=	../../../lib

JAVAC=		javac
JAVAC_FLAGS=	-d . -g -classpath $(FSM_LIB_DIR)/statemap.jar

# Uncomment to turn on reflection.
# REFLECT = 	-reflect

SMC=		java -jar ../../../bin/Smc.jar
SMC_FLAGS=	-java -g $(REFLECT)

JAR=		jar
JAR_CREATE_FLAGS=	cmf manifest.txt
JAR_UPDATE_FLAGS=	uf

#################################################################
# Rules.
#

all :		$(TARGET)

%Context.java : %.sm
		$(SMC) $(SMC_FLAGS) $<

%_sm.dot :	%.sm
		$(SMC) -graph -glevel 1 $<

$(TARGET) :	$(SOURCES)
		$(JAVAC) $(JAVAC_FLAGS) $(SOURCES)
		$(JAR) $(JAR_CREATE_FLAGS) $(TARGET) \
			$(PACKAGE_DIR)/*.class $(SOUND_DIR)/*.au
		$(JAR) $(JAR_UPDATE_FLAGS) $(TARGET) \
			-C $(FSM_LIB_DIR) statemap

graph :		$(SM_SOURCES:%.sm=%_sm.dot)

clean :
		-rm -f *Context.java \
			$(PACKAGE_DIR)/*.class \
			$(TARGET) \
			*_sm.dot
		-rm -fr $(PACKAGE_DIR)

#
# CHANGE LOG
# $Log: Makefile,v $
# Revision 1.6  2005/06/08 11:09:13  cwrapp
# + Updated Python code generator to place "pass" in methods with empty
#   bodies.
# + Corrected FSM errors in Python example 7.
# + Removed unnecessary includes from C++ examples.
# + Corrected errors in top-level makefile's distribution build.
#
# Revision 1.5  2005/05/28 13:51:24  cwrapp
# Update Java examples 1 - 7.
#
# Revision 1.1  2004/10/30 12:02:19  charlesr
# Added Graphviz rules.
#
# Revision 1.0  2003/12/14 20:22:25  charlesr
# Initial revision
#
