# makefile 

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

# This Makefile was written by Dirk Sturzebecher, sturze@ibr.cs.tu-bs.de
# Have a look at www.ibr.cs.tu-bs.de/~sturze/palm for furher info. Use
# freely, but at your own risk!!!
  
# -----------------------------------------------------------------------------

# This Makefile offers:
#   - "make", "make all"   to compile the classes
#   - "make pilot"         to pack the classes into a prc
#                          usage: make clean; make pilot; make clean !!!
#   - "make install"       to install the prc on the Palm (linux only)
#   - "make install-db"    to install the database on the Palm (linux only)
#   - "make install-all"   to install the prc and the database (linux only)
#   - "make fetch-db"      to get the database from the Palm (linux only)
#   - "make dist"          to generate a distribution
#   - "make doc"           to generate API documentation
#   - "make run"           to run your classes on your desktop PC
#   - "make clean"         to cleanup

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

# This Makefile was written for:
#   - J2ME CLCD 1.0
#   - kAWT0.90
#   - JDK1.2.2

# This Makefile is used on a Windows machine.

# To use this Makefile under Win98 you need the following:
#   - CYGWIN tools
#   - starting the make from a bash should require no changes
#   - starting the make from a DOS prompt requires the following changes:
#     - change all ":" path seperators to "\;" (this is due to DOS as ":"
#       is used for the drive letters) 
#     - set the environment variable MAKE_MODE=UNIX
#
# Note: "make install" will not work under Win98

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

# !!! enter the correct path on YOUR system below !!!

MAIN_HOME   =/usr/home/sturze/tmp/palm/java

KVM_HOME    =$(MAIN_HOME)/j2me-1.0
KVM_CLASSES =$(KVM_HOME)/bin/api/classes
KVM_TOOLS   =$(KVM_HOME)/tools/palm/src
KVM_DOC1    =file\;$(KVM_HOME)/doc/CLDCAPI
KVM_DOC2    =file\;$(KVM_HOME)/doc/PalmAPI

KAWT_HOME   =$(MAIN_HOME)/kawt-0.99
KAWT_CLASSES=$(KAWT_HOME)/lib/kawt-0.99.jar
KAWT_DOC    =$(KAWT_HOME)/doc

POP_CLASSES =$(MAIN_HOME)/src/PoP.jar

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

# !!! enter the correct main class, version and creator ID for your application

MAIN_CLASS=PST
MAIN_CREATOR="jPST"
MAIN_VERSION="0.8.5"
MAIN=$(MAIN_CLASS)

MAIN_PDB="PST Stock DB"

DOC_DIR=doc
DIST_FILE=$(MAIN_CLASS)-V$(MAIN_VERSION).jar

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

JAVA =java  -classpath $(KAWT_CLASSES):$(POP_CLASSES):. -Djava.compiler=NONE
JAVAC=javac -deprecation -bootclasspath $(KAWT_CLASSES):$(KVM_CLASSES)
J2PRC=java  -classpath $(KVM_TOOLS):. palm.database.MakePalmApp -version $(MAIN_VERSION) -creator $(MAIN_CREATOR) -icon $(MAIN_CLASS).pbm -bootclasspath $(KVM_CLASSES):$(KAWT_CLASSES)
PREV=$(KVM_HOME)/bin/preverify -classpath $(KAWT_CLASSES):$(KVM_CLASSES):. -d .
JAR=jar cf 
JAVADOC=javadoc -public -classpath $(KAWT_CLASSES):$(KVM_CLASSES) -link $(KAWT_DOC) -link $(KVM_DOC1) -link $(KVM_DOC2) -d $(DOC_DIR)

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

# !!! linux tool to install on pilot

INSTALL=pilot-xfer 

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

# make source files

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

# !!! enter the correct list of classes below !!!

all:\
  PSTDate.class      \
  MoneyData.class    \
  Money.class        \
  Transaction.class  \
  Stock.class        \
  StockStore.class   \
  TableData.class    \
  Table.class        \
  View.class         \
  DetailDialog.class \
  KnownDialog.class  \
  DetailView.class   \
  KnownView.class    \
  HaveView.class     \
  ExpireView.class   \
  TaxView.class      \
  $(MAIN).class

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

.SUFFIXES:	.java .class

%.class: 	%.java
		$(JAVAC) $<

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

# make pilot

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

.PHONY:		pilot

pilot:		all
		$(PREV) .
		$(J2PRC) $(MAIN)

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

# make install

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

.PHONY:		install

install:	
		$(INSTALL) -i $(MAIN).prc

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

# make install-db

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

.PHONY:		install-db

install-db:	
		@cd palm; $(INSTALL) -i $(MAIN_PDB).pdb; cd ..

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

# make install-all

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

.PHONY:		install-all

install-all:	
		$(INSTALL) -i $(MAIN).prc -i palm/$(MAIN_PDB).pdb

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

# make fetch-db

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

.PHONY:		fetch-db

fetch-db:	
		@cd palm; $(INSTALL) -f $(MAIN_PDB); cd ..

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

# make dist

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

.PHONY:		dist

dist:	
		make clean
		make
		$(JAR) $(DIST_FILE) *.class
		make pilot

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

# make doc

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

.PHONY:		doc

doc:	
	        $(JAVADOC) *.java

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

# make printer

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

.PHONY:		printer

printer:	
		javac PSTPrinter.java
		$(JAVA) PSTPrinter

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

# make run-printer

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

.PHONY:		run-printer

run-printer:	
		$(JAVA) PSTPrinter

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

# make run

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

.PHONY:		run

run:		all
		$(JAVA) $(MAIN)

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

# make clean

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

.PHONY:		clean

clean:	
		@rm -f $(MAIN).prc *.class *.log  

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