# 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 = p2

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

#TARGET - name of the program
TARGET = list_test

all: list_test

#compiles the polyterm module
SortedSLL.o: list.h Iterator.h SortedSLL.h SortedSLL.cpp
	$(CC) $(CFLAGS) SortedSLL.cpp

#compiles the list_test module
list_test.o: list.h Iterator.h SortedSLL.h list_test.h list_test.cpp
	$(CC) $(CFLAGS) list_test.cpp

#generates the executable list test main program
list_test: SortedSLL.o list_test.o 
	$(CC) SortedSLL.o list_test.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 SortedSLL.h SortedSLL.cpp $(DIRNAME)
	tar -cvf $(USER).tar $(DIRNAME)

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