TARGET		= ../matrix.a
INCLUDE		= ../include
MAIN_INCLUDE	= ../../include
OBJ		= ./obj

COMPILER=gcc
REAL_TYPE=double
CFLAGS	= -O -DREAL=$(REAL_TYPE) -I$(INCLUDE) -I$(MAIN_INCLUDE)
CC	= $(COMPILER) $(CFLAGS)

OBJS	= $(OBJ)/matrix.o $(OBJ)/vector.o
#OBJS	= $(OBJ)/matrix.o $(OBJ)/vector.o $(OBJ)/ieee.o
LIBS	=

all: $(TARGET)

$(TARGET): $(OBJS)
	ar rv $(TARGET) $(OBJS)
	#
	# This might work to select ranlib if it exists,
	# and ar otherwise.  If it doesn't work, complain.
	#
	if ( test -x /usr/bin/ranlib ) ; \
	then /usr/bin/ranlib $(TARGET) ; \
	else \
	ar ts $(TARGET) ; \
	fi

$(INCLUDE)/vector.h: $(INCLUDE)/matrix.h
	@touch $(INCLUDE)/vector.h

$(OBJ)/matrix.o: matrix.c $(INCLUDE)/matrix.h $(MAIN_INCLUDE)/setup.h Makefile
	$(CC) -c matrix.c -o $(OBJ)/matrix.o

$(OBJ)/vector.o: vector.c $(INCLUDE)/vector.h $(INCLUDE)/matrix.h \
	$(MAIN_INCLUDE)/setup.h Makefile
	$(CC) -c vector.c -o $(OBJ)/vector.o

$(OBJ)/ieee.o: ieee.c $(INCLUDE)/ieee.h Makefile
	$(CC) -c ieee.c -o $(OBJ)/ieee.o

clean:
	rm -f $(OBJ)

clear:
	rm -f $(OBJ) $(TARGET)
