1#edit this for your architecture!
2#ARCH=-m386
3#ARCH=-m486
4#ARCH=-mpentium
5#uncoment following for joystick support
6#JOYSTICK = -D JOYSTICK	#requires joystick toolkit installed!
7#uncoment following to enable network support
8NET = -D NETSUPPORT
9#uncoment following three lines for linux sound support
10SOUND = -D SOUND
11SOUNDSERVER = koules.sndsrv.linux
12INSTALLSOUND = True
13#uncoment following for mouse support
14MOUSE = -D MOUSE
15#don`t add / and spaces at end of path!
16#directories
17SOUNDDIR = /usr/local/lib/koules
18BINDIR = /usr/local/bin
19MANDIR = /usr/local/man/man6
20
21SOUNDOBJS = sound.o
22SOUNDDEV = /dev/dsp
23
24INSTBINFLAGS=-m a=rxs,u=rwxs
25INSTALL = install
26
27CC	 = gcc
28OPTIMIZE = -Isvgalib -fomit-frame-pointer -O3 -ffast-math -s -Dlinux -Wall -DHAVEUSLEEP
29OPTIMIZE1 = -I svgalib -fomit-frame-pointer -O6  -ffast-math -funroll-loops -finline-functions   -s -Dlinux -Wall -DHAVEUSLEEP
30CFLAGS	 = $(DEFINES) $(ARCH) $(JOYSTICK) -DSOUNDDIR="\"$(SOUNDDIR)\"" $(SOUND) $(MOUSE) $(NET)\
31	-DSOUNDSERVER=\"$(SOUNDDIR)/$(SOUNDSERVER)\" \
32	-DSOUNDDIR=\"$(SOUNDDIR)\" \
33	-DSOUNDDEV=\"$(SOUNDDEV)\"
34
35LFLAGS   =
36
37PROGS    = koules.svga
38PROGS_O  = koules.o sound.o menu.o gameplan.o font.o intro.o svgalib/init.o framebuffer.o cmap.o rcfiles.o server.o client.o sock.o objectsio.o
39LIBS     = -lvgagl -lvga
40
41
42all:	progs $(SOUNDSERVER)
43
44progs : $(PROGS)
45
46objs:	$(PROGS_O)
47
48.c.o:
49	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c -o $*.o $<
50
51.c.s:
52	$(CC) $(CFLAGS) $(OPTIMIZE) -S -o $*.s $<
53
54.o:
55	$(CC) $(CFLAGS) $(OPTIMIZE1) $(LFLAGS) -o $* $*.o $(LIBS)
56	chmod a+rs,go-w $*
57
58font.o: font.c
59	@echo please be patient.
60	@echo the font.c is big and ugly i ripped it from zgv.
61	@echo do you know about better one?
62	$(CC) $(OPTIMIZE1) $(CFLAGS) -c  $<
63
64koules.sndsrv.linux.o: koules.sndsrv.linux.c
65	$(CC) $(OPTIMIZE1) $(CFLAGS) -c  $<
66
67koules.o: koules.c
68	$(CC) $(OPTIMIZE1) $(CFLAGS) -Wall -c  $<
69
70koules.svga: $(PROGS_O)
71	$(CC) $(OPTIMIZE1) $(CFLAGS) $(LFLAGS) -o koules.svga $(PROGS_O) $(LIBS) -lm
72
73install:: $(PROG) $(SOUNDSERVER)
74	@echo "Koules directory is " $(BINDIR)
75	@:
76	@echo "Instalin man page to " $(MANDIR)
77	$(INSTALL) -c $(INSTMANFLAGS) koules.svga.6 $(MANDIR);
78	@:
79	@echo "Creating directory " $(BINDIR)
80	@if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
81	$(INSTALL) -c -s $(INSTBINFLAGS) koules.svga $(BINDIR)
82	@:
83	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
84	 then								\
85		echo "Creating directory " $(SOUNDDIR); 		\
86		if [ ! -d $(SOUNDDIR) ]; then mkdir $(SOUNDDIR); fi;    \
87		echo "Copying sound server to directory " $(SOUNDDIR); \
88		$(INSTALL) -c -s $(INSTBIN1FLAGS) $(SOUNDSERVER) $(SOUNDDIR); \
89		echo "Copying sound files into directory " $(SOUNDDIR); \
90		cd ./sounds; set -x;					\
91		for file in *.raw; do					\
92		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(SOUNDDIR);	\
93		done;   						\
94	 fi
95	@echo "Don't forget to remove your old koules from /usr/games/koules "
96	@echo "and /usr/games/kouleslib "
97
98
99clean:
100	rm -f koules.svga $(SOUNDSERVER)
101	rm -f core `find . -name '*.[oas]' -print`
102	rm -f core `find . -name '*~' -print`
103	rm -f core `find . -type f -name 'core' -print`
104
105indent:
106	indent -di16 *.c *.h svgalib/*.c svgalib/*.h xlib/*.c xlib/*.h
107
108lint:
109	export LARCH_PATH=/usr/lib/lclint LCLIMPORTDIR=/usr/lib/lclint;\
110	lclint -weak -Isvgalib $(DEFINES) *.c svgalib/*.c xlib/*.c 2>lint.out;\
111	lclint -weak -Ixlib xlib/*.c 2>>lint.out
112
113dep:
114	rm -f .depend
115	make .depend
116
117.depend:
118	echo '# Program dependencies' >.depend
119	gcc -I svgalib $(DEFINES) -MM $(patsubst %.o,%.c,$(PROGS_O)) >>.depend
120
121include .depend
122