APP=poker

ALL=$(LIBS) $(TEST) $(APP)

APP_SRCS=poker.cpp
APP_OBJS=$(APP_SRCS:.cpp=.o)

APPLIB=poker.lib

APPLIB_SRCS=Card.cpp Hand.cpp Deck.cpp
APPLIB_OBJS=$(APPLIB_SRCS:.cpp=.o)

TEST=tdeck thand tcard # in this order

CPP=g++
CPPFLAGS=-DDEBUG -g

AR=ar -cr 

all:	$(ALL)
app:	$(APP)
lib:	$(APPLIB)
test:	$(TEST)

$(APPLIB):	$(APPLIB_OBJS)
	$(AR) $@ $(APPLIB_OBJS)

$(APP):		$(APP_OBJS) $(APPLIB) 
	$(CPP) $(CPPFLAGS) $(APP_OBJS) $(APPLIB) -o $@
	
tcard:	Card.h Card.cpp
	$(CPP) $(CPPFLAGS) -DSTANDALONE -DDEBUG Card.cpp -o $@

thand:	Hand.h Hand.cpp Card.o
	$(CPP) $(CPPFLAGS) -DSTANDALONE -DDEBUG Hand.cpp Card.o -o $@
	
tdeck:	Deck.h Deck.cpp Hand.o Card.o
	$(CPP) $(CPPFLAGS) -DSTANDALONE -DDEBUG Deck.cpp Hand.o Card.o -o $@

Card.o:	Card.h
Hand.o:	Hand.h
Deck.obj:	Deck.h

.PHONY:	clean wipe

clean:
	rm -f $(APP_OBJS) $(APPLIB_OBJS)
	rm -f $(TEST)

wipe:	clean
	rm -f $(APP) $(APPLIB) 
