#
#  MakeFile for GIANT-GMRES (parts of NewtonLib)
#  Version 1.0.1
#  Latest Change     6th December 2006
#  Written by: Lutz Weimann
#

ARCH = $(shell uname)

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

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

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

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

GIANTGBOBJS = test_giantgmres.o giant_gmres.o gmres.o utils_itlin.o utils_giant.o

results: test_giant_gmres_$(ARCH).out

test_giant_gmres: $(GIANTGBOBJS)
	$(LD) $(LDFLAGS) $(CFLAGS) $(GIANTGBOBJS) -o test_giant_gmres $(ADDLIB)

clean: 
	rm -f *.o test_giant_gmres

test_giantgmres.o giant_gmres.o: giant.h
*.o: itlin.h

%_$(ARCH).out: %
	./$< < test_giant.input > $<_$(ARCH).out
	mv -f test_giantgmres.dat $<_$(ARCH).dat
	mv -f test_giantgmres_lin.dat  $<_lin_$(ARCH).dat
