#  Copyright (C) 2004-2006 Fons Adriaensen <fons.adriaensen@skynet.be>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


PREFIX = /usr
SUFFIX := $(shell uname -m | sed -e 's/^unknown/$//' -e 's/^i.86/$//' -e 's/^x86_64/$/64/')
LIBDIR = lib$(SUFFIX)
VERSION = 0.4.2
DISTDIR = jaaa-$(VERSION)
CPPFLAGS += -O3 -Wall -DVERSION=\"$(VERSION)\" -DPREFIX=\"$(PREFIX)\" -I/usr/include/freetype2
#CPPFLAGS += -march=pentium4

LDFLAGS += -L$(PREFIX)/$(LIBDIR) -L/usr/X11R6/$(LIBDIR)
LDLIBS += -lclalsadrv -lclthreads -lclxclient -lpthread -lfftw3f -ljack -lasound -lpthread -lXft -lX11 -lrt

JAAA_H = styles.h spectwin.h audio.h prbsgen.h rngen.h
JAAA_O = jaaa.o styles.o spectwin.o audio.o rngen.o


jaaa:	$(JAAA_O)
	g++ $(LDFLAGS) -o jaaa $(JAAA_O) $(LDLIBS)


install:	jaaa
	/usr/bin/install -m 755 jaaa $(PREFIX)/bin

$(JAAA_O):	$(JAAA_H)


clean:
	/bin/rm -f *~ *.o *.a *.so jaaa


tarball:
	cd ..; \
	/bin/rm -f -r $(DISTDIR)*; \
	svn export jaaa $(DISTDIR); \
	tar cvf $(DISTDIR).tar $(DISTDIR); \
	bzip2 $(DISTDIR).tar; \
	/bin/rm -f -r $(DISTDIR);
