###############################################################
# Customize the compilation flags here.                       #
###############################################################

# You could put the -DMEM_DEBUG here to find memory problems!
CDEBUGFLAGS = -O

# A developer's (or a tester's) configuration
# CDEBUGFLAGS = -DMEM_DEBUG -DTEST_GAME -Wall -pipe -ansi 

###############################################################
# This is where X app-default files are kept.                 #
###############################################################

# Need this since we use LIBDIR for something else
XAPPLOADDIR = $(USRLIBDIR)/X11/app-defaults

###############################################################
# This is where architecture dependant flags are kept.  If    #
# have to add one to get Frisk to compile on your platform,   #
# please drop me a line telling me what it was.               #
###############################################################

#ifdef HPArchitecture
CCOPTIONS = -Ae
#endif

#ifdef SunArchitecture
CCOPTIONS = -ansi
#endif

###############################################################
### SHOULDN'T NNED TO CHANGE ANYTHING AFTER THIS!           ###
###############################################################

# Data files
MAP = World.risk
COUNTRY = Countries.risk
HELP = Help.risk

# Flags & programs
DEFINES = -DMAPFILE=\"$(LIBDIR)/$(MAP)\" -DCOUNTRYFILE=\"$(LIBDIR)/$(COUNTRY)\" -DHELPFILE=\"$(LIBDIR)/$(HELP)\" 
PROGRAMS = findtypes types.h xfrisk friskserver buildmap \
	World.risk Countries.risk

# The client program
SRCS1 =  client.c network.c gui.c callbacks.c utils.c dice.c cards.c \
	 game.c colormap.c help.c riskgame.c debug.c client-main.c
OBJS1 =  client.o network.o gui.o callbacks.o utils.o dice.o cards.o \
	 game.o colormap.o help.o riskgame.o debug.o client-main.o

# The server program
SRCS2 = server.c network.c deck.c riskgame.c debug.c server-main.c
OBJS2 = server.o network.o deck.o riskgame.o debug.o server-main.o

# The map building program
SRCS3 = buildmap.c debug.c
OBJS3 = buildmap.o debug.o

# The architecture analysis program
SRCS4 = findtypes.c
OBJS4 = findtypes.o

# The computer player library
SRCS5 = network.c client.c utils.c dice.c game.c riskgame.c debug.c \ 
	client-main.c
OBJS5 = network.o client.o utils.o dice.o game.o riskgame.o debug.o \ 
	client-main.o

# The targets and directives
ComplexProgramTarget_1(xfrisk, XawClientLibs, )
ComplexProgramTarget_2(friskserver, , )
SingleProgramTarget(buildmap, $(OBJS3), , )
SingleProgramTarget(findtypes, $(OBJS4), , )
NormalLibraryTarget(frisk, $(OBJS5))
MakeDirectories(install,$(LIBDIR))
InstallAppDefaults(XFrisk)
InstallMultipleFlags($(MAP),$(LIBDIR),-m 644)
InstallMultipleFlags($(COUNTRY),$(LIBDIR),-m 644)
InstallMultipleFlags($(HELP),$(LIBDIR),-m 644)
InstallMultipleFlags(risk,$(BINDIR),-m 755)

# Other targets
Countries.risk World.risk:: World.ppm buildmap
	./buildmap World.ppm World.risk Countries.risk

types.h:: findtypes
	./findtypes

version::
	touch version.h

# A few needed dependancies (more of an approximation)
xfrisk: World.risk Countries.risk
gui.o: resources.h



