# Copyright 2004,2006 Jouni K. Seppnen          -*- coding: iso-8859-1 -*-
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE.

VERSION=1.0

CXX=g++
CXXFLAGS=-Wall -ggdb3
#LINKFLAGS=-framework vecLib
LINKFLAGS=-L/usr/lib64/atlas
#LIBS=-llapack -lcblas -lf77blas -latlas -lf2c
#LIBS=-lcblas -lf77blas -latlas
LIBS=-lcblas -latlas

OBJECTS=main.o matrices.o model.o tile.o search.o
SOURCES=main.cpp matrices.cpp model.cpp tile.cpp search.cpp
HEADERS=matrices.h model.h tile.h search.h
EXTRAS=mtest.cpp spectral.cpp Makefile README LICENSE reorder.m
DISTRIBUTABLES=$(SOURCES) $(HEADERS) $(EXTRAS)

all: tilings
clean:
	rm -f $(OBJECTS) tilings

dist:
	mkdir tilings-$(VERSION)
	cp -l $(DISTRIBUTABLES) tilings-$(VERSION)
	tar -c -f tilings-$(VERSION).tar -h tilings-$(VERSION)
	bzip2 -9 tilings-$(VERSION).tar
	rm -rf tilings-$(VERSION)

tilings: $(OBJECTS)
	$(CXX) $(CXXFLAGS) $(LINKFLAGS) -o $@ $(OBJECTS) $(LIBS)

matrices.o: matrices.h
model.o: matrices.h model.h tile.h
search.o: matrices.h model.h tile.h search.h
tile.o: matrices.h tile.h
main.o: matrices.h model.h search.h

TAGS: *.cpp *.h
	etags -I --members --lang=c++ *.cpp *.h

mtest.o: matrices.h
mtest: mtest.o matrices.o
	g++ -framework vecLib -ggdb3 -o mtest mtest.o matrices.o

spectral.o: matrices.h
spectral: spectral.o matrices.o
	$(CXX) $(CXXFLAGS) $(LINKFLAGS) -o spectral \
	spectral.o matrices.o $(LIBS)
