CPP		= g++
JC		= javac
LINK		= gcc

JAVAFLAGS	= -d . -classpath .
PREFFLAGS	=
CPPFLAGS	= $(PREFFLAGS)
LINKFLAGS	=

PREFIX		= /usr/local

ALL_PKGS	= ModSQL SampleDatabase TemporaryDatabase AsciiDatabase
ALL_PROGS	= modsql
ALL_CLASSES	= modsql.class

COMMON_OBJS	= 
COMMON_HEADERS	= 


.SUFFIXES: .java .class

.java.class:
	$(JC) $(JAVAFLAGS) $*.java
	@touch $*.class

.PHONY:	$(ALL_PKGS) doc


all:	$(ALL_PKGS) $(ALL_CLASSES) $(ALL_PROGS)

$(ALL_PKGS):
	cd $@; $(MAKE)

install:	$(ALL_PROGS) $(ALL_CLASSES)
	if [ ! -d $(PREFIX)/classes ]; then mkdir $(PREFIX)/classes; fi
	tar cf - *.class */*.class | (cd $(PREFIX)/classes; tar xf -)
	cp $(ALL_PROGS) $(PREFIX)/bin

doc:
	rm -rf doc/*
	cd doc; javadoc -link http://java.sun.com/products/jdk/1.3/docs/api -private -author -sourcepath ../ $(ALL_PKGS)

doc-local:
	rm -rf doc/*
	cd doc; javadoc -private -author -sourcepath ../ $(ALL_PKGS)

clean:
	for i in $(ALL_PKGS); do cd $$i; $(MAKE) clean; cd ..; done
	rm -f *% *~ *.o core $(ALL_PROGS) $(ALL_CLASSES)
