
VERSION=1.1

QTCLIENTOPTS=--with-Qt-include-dir=/usr/include/qt --with-Qt-bin-dir=/usr/bin --with-Qt-lib-dir=/usr/lib
GNOMECLIENTOPTS=--disable-gnome
SERVEROPTS=
PREFIX=--prefix=/home/lonestar/c/test/install

build: build-server build-qtclient build-gnomeclient
#	( cd javaclient && make && echo "Java client built succesfully" )

build-server:
	( cd server && autoconf && ./configure $(PREFIX) $(SERVEROPTS) >& ../build.output.server.configure && make >& ../build.output.server.make && echo "Server built successfully" || echo "Build failed ... please examine build.ouput.server for details" )

build-qtclient:
	( cd qtclient && aclocal && autoconf && ./configure $(PREFIX) $(QTCLIENTOPTS) >& ../build.output.qtclient.configure && make >& ../build.output.qtclient.make && echo "QT client built successfully" || echo "Build failed ... please examine build.ouput.qtclient for details"  )

build-gnomeclient:
	( cd gnomeclient && ./autogen.sh $(PREFIX) $(GNOMECLIENTOPTS) >& ../build.output.gnomeclient.configure && make >& ../build.output.gnomeclient.make && echo "Gtk Client built successfully" || echo "Build failed ... please examine build.ouput.gnomeclient for details"  )

install:
	( cd server && make install || echo "Installation of server failed" )
	( cd qtclient && make install || echo "Installation of qtclient failed" )
	( cd gnomeclient && make install || echo "Installation of gnomeclient failed" )

distclean-server:
	( cd server && make distclean || echo "Error while cleaning server" )

distclean-qtclient:
	( cd qtclient && make distclean || echo "Error while cleaning qtclient" )

distclean-gnomeclient:
	( cd gnomeclient && make distclean || echo "Error while cleaning gnomeclient" )

distclean: distclean-server distclean-qtclient distclean-gnomeclient
	rm -f build.output.*
	rm -f *-stamp
#	( cd javaclient && make distclean || echo "Error while cleaning javaclient" )

packages: distclean
	rm -f build.output.*
	( cd .. && tar -c --bzip2 -f fireflier_$(VERSION)_all.tar.bz2 fireflier-$(VERSION) )
	( cd .. && tar -c --bzip2 -hf fireflier_$(VERSION)_client-gnome.tar.bz2 fireflier-$(VERSION)/gnomeclient )
	( cd .. && tar -c --bzip2 -hf fireflier_$(VERSION)_client-qt.tar.bz2 fireflier-$(VERSION)/qtclient )
	( cd .. && tar -c --bzip2 -hf fireflier_$(VERSION)_client-server.tar.bz2 fireflier-$(VERSION)/server )
#	( cd .. && tar -c --bzip2 -hf fireflier_$(VERSION)_client-java.tar.bz2 fireflier-$(VERSION)/javaclient )
	