#  Copyright (C) 2004-2008 Fons Adriaensen <fons@kokkinizita.net>
#
#  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/local
SUFFIX := $(shell uname -m | sed -e 's/^unknown/$//' -e 's/^i.86/$//' -e 's/^x86_64/$/64/')
LIBDIR = lib$(SUFFIX)
VERSION = 0.4.0
DISTDIR = jnoise-$(VERSION)
CPPFLAGS += -O3 -Wall -MMD -MP -DVERSION=\"$(VERSION)\" -DPREFIX=\"$(PREFIX)\"
#CPPFLAGS += -march=pentium4
LDFLAGS += -L$(PREFIX)/$(LIBDIR) -L/usr/X11R6/$(LIBDIR)
LDLIBS += -ljack -lrt


JNOISE_O = jnoise.o rngen.o
jnoise:	$(JNOISE_O)
	g++ $(LDFLAGS) -o $@ $(JNOISE_O) $(LDLIBS)

$(JNOISE_O):
-include $(JNOISE_O:%.o=%.d)


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

$(JNOISE_O):	$(JNOISE_H)


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


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