#
# The Makefile for the SPTOSSG Package
#
# This package is a java application that reads a Waterhouse .HTML S&P
# report and generates a .SSG stock data file suitable to be imported into
# stock analysis tools such as Investors Toolkit.

#--------------------------------------------------------------------
# Package specific settings

# JARLIBS - Any .JAR files used by this package (colon separated)
XJARLIBS = ./gnu-regexp-1.0.3.jar
JARLIBS = ./gnu-regexp-1.0.5.jar

# PACKAGE_NAME - The java package name (using periods)
PACKAGE_NAME = sptossg

# PACKAGE_DIR - The java package name (using slashes)
PACKAGE_DIR = sptossg

# RUNCLASS & RUNARGS - The top level class to be run by 'make run' along
# with any arguments.
RUNCLASS = SPReportParser
RUNARGS = msft.html

# OBJECTDIR - the directory where class files are stored
OBJECTDIR = classes

# CLASSES - Files to be compiled.  order is important here!  Until Makefile
# dependencies are added to this file, these classes have to be ordered
# with any files requiring other files be listed afterwards.
CLASSES =  \
		$(OBJECTDIR)/$(PACKAGE_DIR)/Period.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/DataSet.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/CompanyStorage.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/Formula.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/DynamicDataSet.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/CompanyInfo.class \
		\
		$(OBJECTDIR)/$(PACKAGE_DIR)/SectionParser.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/TableDataEnumeration.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/TableRowEnumeration.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/AttributeTranslator.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/BREnumeration.class \
		$(OBJECTDIR)/$(PACKAGE_DIR)/SPReportParser.class

#--------------------------------------------------------------------
# Java
#JAVAHOME=/usr/local/java
#JAVA = $(JAVAHOME)/bin/java
#JAVAC = $(JAVAHOME)/bin/javac
JAVA = java
JAVAC = javac

.SUFFIXES: .java .class

LOCAL_CLASSPATH = ./classes:$(JARLIBS):$(CLASSPATH)

JAVAC_FLAGS = -d $(OBJECTDIR) -classpath $(LOCAL_CLASSPATH)

#--------------------------------------------------------------------

all: $(OBJECTDIR)/$(PACKAGE_DIR) $(CLASSES)

clean:
	rm -rf $(OBJECTDIR)/$(PACKAGE_DIR)

run: all
	java -classpath $(LOCAL_CLASSPATH) $(PACKAGE_NAME).$(RUNCLASS) $(RUNARGS)

TESTCLASS = CompanyInfo
TESTARGS = 

test: all
	java -classpath $(LOCAL_CLASSPATH) $(PACKAGE_NAME).$(TESTCLASS) $(TESTARGS)

# How to convert a .java to a .class file:  compile the file
$(OBJECTDIR)/$(PACKAGE_DIR)/%.class: %.java
	$(JAVAC) $(JAVAC_FLAGS) $<

$(OBJECTDIR)/$(PACKAGE_DIR):
	mkdir -p $@

