1#
2#   XFrisk - The classic board game for X
3#   Copyright (C) 1993-1999 Elan Feingold (elan@aetherworks.com)
4#
5#   This program is free software; you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation; either version 2 of the License, or
8#   (at your option) any later version.
9#
10#   This program is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#   GNU General Public License for more details.
14#
15#   You should have received a copy of the GNU General Public License
16#   along with this program; if not, write to the Free Software
17#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18#
19#   $Id: Makefile,v 1.22 2000/01/23 19:01:55 tony Exp $
20#
21#   $Log: Makefile,v $
22#   Revision 1.22  2000/01/23 19:01:55  tony
23#   default to Xaw3d, with comment
24#
25#   Revision 1.21  2000/01/20 18:03:20  morphy
26#   Cleanup, comments to aid the non-initiated and reordering for clarity
27#
28#   Revision 1.20  2000/01/18 19:55:06  morphy
29#   Minor correction to Drop All Armies prevention
30#
31#   Revision 1.19  2000/01/18 18:56:04  morphy
32#   Added note and option: -DNARROWPROTO fixes Xaw scrollbars
33#
34#   Revision 1.18  2000/01/17 21:11:34  tony
35#   fix on dropping armies during fortification, made configurable from here
36#
37
38##################
39# Language options
40# Define only either one, not both
41LANGUAGE=ENGLISH
42#LANGUAGE=FRENCH
43
44
45##################
46# Gameplay options
47# Dropping more than 1 army while fortifying:
48# Use this one to disallow dropping all...
49DROPALL=
50# ... or this one to allow dropping all at once
51#DROPALL=-DDROPALL
52# The max number of armies to drop is set in game.c, DROP_ARMIES
53# which will be ignored it DROPALL is not set
54
55####################
56# C compiler options
57# GNU gcc is recommended.
58CC?=gcc
59# Use these with gcc
60CFLAGS+= -Wall -W -fno-common -pedantic
61
62# If you don't have gcc, don't use -Wall -W -fno-common
63#CFLAGS=-g
64
65# Debugging options - these don't all work
66# Assertions catch "shouldn't happen" type errors and immediately terminate the game
67# if one is caught
68#CFLAGS+=-DASSERTIONS
69#
70# For debugging memory problems
71#CFLAGS+=-DMEM_DEBUG
72#
73# For logging
74#CFLAGS+=-DLOGGING
75#
76# Test games (quick start)
77#CFLAGS+=-DTEST_GAME
78
79## Initial linker options
80LDFLAGS=
81
82## Installation prefix
83# Adjust to taste. Stuff gets installed here.
84PREFIX?=/usr/local
85#PREFIX=/usr/local/X11
86
87## X11 location and options
88# for X11R6
89# Point this at your X tree.
90XDIR?=/usr/local
91#XDIR=/usr/local/X11
92#XDIR=/usr/openwin
93
94# try Xaw if you don't have Xaw3d
95#XAW=Xaw
96XAW=Xaw3d
97
98XLIBS=-L$(XDIR)/lib -l$(XAW) -lXext -lXmu -lXt -lSM -lICE -lX11
99
100XINC=-I$(XDIR)/include
101CFLAGS+=$(XINC)
102
103# for X11R5
104#XLIBS=-L$(XDIR)/lib -lXaw -lXext -lXmu -lXt -lX11
105
106# System V (Solaris, Irix, etc.) will probably want -lsocket -lnsl.
107#LIBS=-lsocket -lnsl
108# on other systems leave LIBS blank for now
109LIBS=
110
111# On some systems -DNARROWPROTO is needed for working Xaw scrollbars
112# This includes FreeBSD 3.x and recent Linux
113CFLAGS+=-DNARROWPROTO
114
115# If the link fails because it can't find snprintf, uncomment this.
116#COMPAT_OBJS+=snprintf.o
117
118# If you get complaints about ranlib not being found, exchange these.
119RANLIB=ranlib
120#RANLIB=true
121
122# For HPUX
123#CFLAGS+=-Ae
124
125# For Suns with OpenWindows
126#CFLAGS+=-I/usr/openwin/include
127
128# On particularly lame systems (e.g., Solaris 2.5) you may need to
129# uncomment this.
130#XLIBS+=-Wl,-rpath,$(XDIR)/lib
131
132# For BSD/OS (BSD/OS's ranlib sometimes seems to munch files)
133#XLIBS+=-lipc
134#RANLIB=true
135
136# For BSD and other nonbroken systems
137INSTALL_DATA=install -c -m 644
138INSTALL_BIN=install -c -m 755
139# For systems without a BSD install
140#INSTALL_DATA=cp
141#INSTALL_BIN=cp
142
143
144############################################################
145#          You shouldn't need to edit below here           #
146############################################################
147
148LIBDIR=$(PREFIX)/lib/xfrisk
149BINDIR=$(PREFIX)/bin
150
151# Data files, stored in LIBDIR
152MAP=World.risk
153COUNTRY=Countries.risk
154HELP=Help.risk
155
156# Flags & programs
157DEFINES=-D$(LANGUAGE) -DMAPFILE=\"$(LIBDIR)/$(MAP)\" -DCOUNTRYFILE=\"$(LIBDIR)/$(COUNTRY)\" -DHELPFILE=\"$(LIBDIR)/$(HELP)\" $(DROP_ONE)
158
159CFLAGS+=$(DEFINES)
160
161# The targets and directives
162all:  xfrisk friskserver aiDummy aiConway aiColson World.risk Countries.risk
163
164# The client program
165GAMEOBJS=client.o network.o gui.o callbacks.o utils.o dice.o cards.o \
166	 game.o colormap.o help.o riskgame.o debug.o clientMain.o colorEdit.o \
167	 registerPlayers.o addPlayer.o viewStats.o viewCards.o viewLog.o \
168	 viewChat.o viewFeedback.o
169
170xfrisk: $(GAMEOBJS) $(COMPAT_OBJS)
171	$(CC) $(LDFLAGS) $^ $(XINC) $(XLIBS) $(LIBS) -o $@
172
173# The server program
174SERVEROBJS=server.o network.o deck.o riskgame.o debug.o clients.o serverMain.o
175
176# these could be compiled without X as soon as callbacks gets fixed :-)
177# right now compile will break if the X include files are not found
178friskserver: $(SERVEROBJS) $(COMPAT_OBJS)
179	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
180
181ai: aiDummy aiConway aiColson
182
183
184# The map building program
185buildmap: buildmap.o debug.o
186	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
187
188# The architecture analysis program
189findtypes: findtypes.o
190	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
191
192# A framework for a computer player
193aiDummy: aiDummy.o libfriskAI.a
194	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
195
196# A real computer player, by Andrew Conway
197aiConway: aiConway.o libfriskAI.a
198	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
199
200# A real computer player, by Jean-Claude Colson
201aiColson: aiColson.o libfriskAI.a
202	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
203
204# The computer player library
205libfriskAI.a: network.o aiDice.o game.o riskgame.o debug.o aiClientMain.o \
206		aiController.o aiStubs.o $(COMPAT_OBJS)
207	$(AR) -cruv $@ $^
208	$(RANLIB) $@
209
210install: all
211	-(umask 022; mkdir -p -m755 $(LIBDIR) $(BINDIR) $(APPLOADDIR))
212	$(INSTALL_DATA) $(MAP) $(LIBDIR)
213	$(INSTALL_DATA) $(COUNTRY) $(LIBDIR)
214	$(INSTALL_DATA) $(HELP) $(LIBDIR)
215	$(INSTALL_BIN) risk $(BINDIR)
216	$(INSTALL_BIN) xfrisk $(BINDIR)
217	$(INSTALL_BIN) friskserver $(BINDIR)
218	$(INSTALL_BIN) aiDummy $(BINDIR)
219	$(INSTALL_BIN) aiConway $(BINDIR)
220	$(INSTALL_BIN) aiColson $(BINDIR)
221
222
223# Other targets
224Countries.risk World.risk: World.ppm buildmap
225	./buildmap World.ppm World.risk Countries.risk
226
227uninstall:
228	rm -rf $(LIBDIR)
229	rm -f  $(BINDIR)/risk
230	rm -f  $(BINDIR)/xfrisk
231	rm -f  $(BINDIR)/friskserver
232	rm -f  $(BINDIR)/aiDummy
233	rm -f  $(BINDIR)/aiConway
234	rm -f  $(BINDIR)/aiColson
235
236types.h: findtypes
237	./findtypes
238
239version:
240	touch version.h
241
242include depend.mk
243depend: types.h
244	$(CC) $(CFLAGS) -MM *.c >depend.mk
245
246depend.mk:
247	touch depend.mk
248	$(MAKE) depend
249
250tidy:
251	rm -f *.log *~ core
252
253clean: tidy
254	rm -f *.o *.a findtypes types.h buildmap Countries.risk World.risk
255
256distclean: clean
257	rm -f aiDummy aiConway aiColson xfrisk friskserver depend.mk core
258
259check:
260	find . -type f \! -perm 444 \! -perm 555 -print
261
262