#
#  MakeFile for GMRES (part of NewtonLib)
#  Version 1.0
#  Latest Change     6th December 2006
#  Written by: Lutz Weimann
#

ARCH = $(shell uname)

#CFLAGS = -g $(DFLAGS) -DDEBUG
CFLAGS = -g $(DFLAGS)

ifeq ($(ARCH),SunOS)
CC = cc
ADDLIB = -lm
LD = $(CC)
#LDFLAGS = -Bstatic
endif    #ifeq ($(ARCH),SunOS)

ifeq ($(ARCH),Darwin)
LD = $(CC)
ADDLIB = -lSystemStubs
endif    #ifeq ($(ARCH),Darwin)

ifeq ($(ARCH),Linux)
LD = $(CC)
ADDLIB = -lm
endif    #ifeq ($(ARCH),Linux)

GMRESOBJS = test_gmres.o gmres.o utils.o
RESULTS = test_gmres_$(ARCH).out
                 
results: $(RESULTS)

test_gmres: $(GMRESOBJS)
	$(LD) $(LDFLAGS) $(CFLAGS) $(GMRESOBJS) -o test_gmres \
	$(ADDLIB)

test_gmres_$(ARCH).out: test_gmres
	./$< > $@
	mv test_gmres_misc.data test_gmres_misc_$(ARCH).data
	mv test_gmres.data test_gmres_$(ARCH).data
	mv test_gmres_iter.data test_gmres_iter_$(ARCH).data
	mv test_gmres_res.data test_gmres_res_$(ARCH).data

clean: 
	rm -f *.o test_gmres

*.o: itlin.h
