###############################################################
# Customize the compilation flags here.                       #
###############################################################
LANGUAGE = ENGLISH
# You could put the -DMEM_DEBUG here to find memory problems!
#CDEBUGFLAGS = -g -ansi -Wall -pedantic -DMEM_DEBUG -DASSERTIONS
CDEBUGFLAGS = -g

# A developer's (or a tester's) configuration -DLOGGING
# CDEBUGFLAGS = -g -DASSERTIONS -DMEM_DEBUG -DTEST_GAME

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

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

###############################################################
# 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 NEED TO CHANGE ANYTHING AFTER THIS!           ###
###############################################################

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

# Flags & programs
DEFINES = -D$(LANGUAGE) -DMAPFILE=\"$(LIBDIR)/$(MAP)\" -DCOUNTRYFILE=\"$(LIBDIR)/$(COUNTRY)\" -DHELPFILE=\"$(LIBDIR)/$(HELP)\" 
PROGRAMS = findtypes types.h xfrisk friskserver buildmap aiDummy aiConway aiColson\
	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 clientMain.c colorEdit.c \
	 registerPlayers.c addPlayer.c viewStats.c viewCards.c viewLog.c \
	 viewChat.c viewFeedback.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 clientMain.o colorEdit.o \
	 registerPlayers.o addPlayer.o viewStats.o viewCards.o viewLog.o \
	 viewChat.o viewFeedback.o

# The server program
SRCS2 = server.c network.c deck.c riskgame.c debug.c serverMain.c
OBJS2 = server.o network.o deck.o riskgame.o debug.o serverMain.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 aiDice.c game.c riskgame.c debug.c aiClientMain.c \
	aiController.c aiStubs.c
OBJS5 = network.o aiDice.o game.o riskgame.o debug.o aiClientMain.o \
	aiController.o aiStubs.o

# A framework for a computer player
SRCS6 = aiDummy.c
OBJS6 = aiDummy.o

# A real computer player, by Andrew Conway
SRCS7 = aiConway.c
OBJS7 = aiConway.o

# A real computer player, by Jean-Claude Colson
SRCS8 = aiColson.c
OBJS8 = aiColson.o

# The targets and directives
ComplexProgramTarget_1(xfrisk, XawClientLibs, )
ComplexProgramTarget_2(friskserver, , )
SingleProgramTarget(buildmap, $(OBJS3), , )
SingleProgramTarget(findtypes, $(OBJS4), , )
NormalLibraryTarget(frisk, $(OBJS5))
SingleProgramTarget(aiDummy, $(OBJS6), -L./ -lfrisk, )
SingleProgramTarget(aiConway, $(OBJS7), -L./ -lfrisk, )
SingleProgramTarget(aiColson, $(OBJS8), -L./ -lfrisk, )
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

clean::
	rm -f *.log

zip::
	zip -f /mnt/new/Archives/Elan/Frisk-0.99.zip

# A few needed dependancies (more of an approximation)
aiDummy: libfrisk.a
aiConway: libfrisk.a
aiColson: libfrisk.a
friskserver: types.h
xfrisk: World.risk Countries.risk 
gui.o: english.res french.res 
$(OBJS1) $(OBJS2): types.h
