# Flags for the compiler:
# 	-g - generate code for debugger
# 	-Wall - generate warnings about suspect operations ...
# 	-c - generate binary object code
CFLAGS= -g -Wall -c

# Flags to generate the executable program:
# 	-o - used to give a name to the program
OFLAGS = -o

#Name of C++ compiler
#	g++ - GNU C++ compiler
CC = g++

# Project Name
PNAME = p1

# Project Submission Directory
# This is the user name followed by the project name
DIRNAME = $(USER)$(PNAME)

#TARGET - name of the program
TARGET = matrix_main

all: matrix_main

#compiles the matrix module
Matrix.o: Object.h Matrix.h Matrix.cpp
	$(CC) $(CFLAGS) Matrix.cpp

#coompiles the vector module
Vector.o: Vector.h Vector.cpp
	$(CC) $(CFLAGS) Vector.cpp

#compiles the 3D vector module
Vector3D.o: Vector3D.h Vector3D.cpp
	$(CC) $(CFLAGS) Vector3D.cpp

#compiles the matrix main module
matrix_main.o: matrix_main.cpp
	$(CC) $(CFLAGS) matrix_main.cpp

#generates the executable matrix main program
matrix_main: Matrix.o Vector.o Vector3D.o matrix_main.o
	$(CC) Matrix.o Vector.o Vector3D.o matrix_main.o $(OFLAGS) $(TARGET)

#Removes all .o files
clean:
	/bin/rm -f *.o

#Removes all .o files and the executable
delete: 
	/bin/rm -f *.o core
	/bin/rm -rf $(TARGET)
	/bin/rm -f *~
 

#create the project submit directory
sdir:
	/bin/rm -rf $(DIRNAME)
	mkdir $(DIRNAME)
	cp Matrix.cpp Vector.cpp Vector3D.cpp $(DIRNAME)
	tar -cvf $(USER).tar $(DIRNAME)

# submits the project
submit:
	/home/profs/manuel/bin/submit 1 $(USER).tar
