include version

prefix = /usr/local
distname = teaserandfirecat

# If you have a BSD system
# SYSTEM = "-DBSD=1"
# If you have a SVR4 system
# SYSTEM = "-DSVR4=1"

# Uncoment the following line if you use a Debian system (or any other
# that stores crypt() in libcrypt).
CONDS = debian

# SuSE stores the PostgreSQL header files in a different location
# to Debian.
# CONDS = suse

JAVAC = javac
JAR = jar
CLASSDIR = /usr/local/lib
BINDIR = $(prefix)/bin
DOCDIR = $(prefix)/doc/$(distname)-$(VERSION)
DISTDIR = $(distname)-$(VERSION)

SRC = Makefile TFP-1.3 COPYING version INSTALL TODO create_teaserdb.psql \
      CREDITS src README TFP-2.0.txt au include

all: teaser firecat

teaser: db
	cd src && make CONDS=$(CONDS) SYSTEM=$(SYSTEM)

firecat:
	cd au/com/bowerbird/firecat && make JAVAC=$(JAVAC)
	$(JAR) cvf firecat.jar au/com/bowerbird/firecat/*.class

db:
	createdb teaserdb
	psql -f create_teaserdb.psql -d teaserdb

install: teaser firecat
	mv src/teaser $(BINDIR)
	mv firecat.jar $(CLASSDIR)


dist: 
	-rm -fr $(DISTDIR)
	-rm $(DISTDIR).tar.gz
	mkdir $(DISTDIR)
	cp -r $(SRC) $(DISTDIR)
	cd $(DISTDIR) && make distclean
	tar -zcvf $(DISTDIR).tar.gz $(DISTDIR)

clean:
	cd src && make clean
	cd au/com/bowerbird/firecat && rm -f *.class 

distclean:
	cd src && make distclean
	cd au/com/bowerbird/firecat && rm -f *.class *~



