#
#	~yas/dsys/highscore/centralized/Makefile
#

CFLAGS = -g

libs=
#Solaris
#libs= -lsocket -lnsl
#CC=gcc

.SUFFIXES: .npr
.c.npr:
	npr $< > $*.npr
.h.npr:
	npr $< > $*.npr

all: add-hiscore show-hiscore highscore-server

add-hiscore: add-hiscore.o highscore-client.o marshaling-burffer.o
	$(CC) $(CFLAGS) add-hiscore.o highscore-client.o marshaling-burffer.o -o $@ $(libs)

add-hiscore.o: add-hiscore.c highscore-tcp.h

show-hiscore: show-hiscore.o highscore-client.o marshaling-burffer.o
	$(CC) $(CFLAGS) show-hiscore.o highscore-client.o marshaling-burffer.o -o $@ $(libs)

show-hiscore.o: show-hiscore.c highscore-tcp.h

highscore-server: highscore-server.o marshaling-burffer.o
	$(CC) $(CFLAGS) highscore-server.o marshaling-burffer.o -o $@ $(libs)

highscore-server.o: highscore-server.c highscore-tcp.h marshaling-burffer.h

highscore-client.o: highscore-client.c highscore-tcp.h marshaling-burffer.h

marshaling-burffer.o: marshaling-burffer.c marshaling-burffer.h

clean:
	$(RM) add-hiscore show-hiscore *.o

help:
	@echo Open two terminals for server and client
	@echo 
	@echo server: 
	@echo ./highscore-server portno
	@echo "(To stop this server, Press ^C)"
	@echo 
	@echo client: 
	@echo ./add-hiscore  server portno score name
	@echo ./show-hiscore server portno num
	@echo 

