1VERSION="Koules v1.1c - OS/2 Beta 3.2"
2
3DEFINES=-D OS2VERSION=\"$(VERSION)\"
4#edit this for your architekture!
5#ARCH=-m386
6ARCH=-m486
7#ARCH=-mpentium
8#uncoment following for joystick support
9#JOYSTICK = -D JOYSTICK	#requires joystick toolkit installed!
10#uncoment following three lines for linux sound support
11SOUND = -D SOUND
12#SOUNDSERVER = koules.sndsrv.linux
13#INSTALLSOUND = True
14#uncoment following for mouse support
15MOUSE = -D MOUSE
16#don`t add / and spaces at end of path!
17#directories
18#SOUNDDIR = /usr/local/lib/koules
19#BINDIR = /usr/local/bin
20#MANDIR = /usr/man/man6
21
22#SOUNDOBJS = sound.o
23#SOUNDDEV = /dev/dsp
24
25
26INSTALL = install
27
28CC	 = gcc
29#OPTIMIZE = -Wall
30OPTIMIZE = -I os2dive -fomit-frame-pointer -O6  -ffast-math -DOS2DIVE -DASSEMBLY -D__i386__ -Zomf -Zmt
31OPTIMIZE1 = -I os2dive -fomit-frame-pointer -O6  -ffast-math -funroll-loops -finline-functions -DOS2DIVE -DASSEMBLY -D__i386__ -Zomf -Zmt
32#OPTIMIZE =  -O2 -g -p
33#OPTIMIZE1 =  -O2 -g  -p
34CFLAGS	 = $(DEFINES) $(ARCH) $(JOYSTICK) -DSOUNDDIR="\"$(SOUNDDIR)\"" $(SOUND) $(MOUSE)\
35	-DSOUNDSERVER=\"$(BINDIR)/$(SOUNDSERVER)\" \
36	-DSOUNDDIR=\"$(SOUNDDIR)\" \
37	-DSOUNDDEV=\"$(SOUNDDEV)\"
38
39LFLAGS   =  -Zsys -Zmts -Zomf os2dive/koules.def
40
41PROGS    = koules.exe
42PROGS_O  = koules.obj menu.obj gameplan.obj font.obj intro.obj os2dive/pm_main.obj os2dive/init.obj os2dive/input.obj framebuffer.obj cmap.obj rcfiles.obj soundos2.obj
43LIBS     = -ldive -los2me -lvga -lvgagl
44
45
46all:	progs $(SOUNDSERVER)
47
48progs : $(PROGS)
49
50objs:	$(PROGS_O)
51
52koules.exe: $(PROGS_O) koules.res
53	$(CC) $(OPTIMIZE1) $(CFLAGS) $(LFLAGS) -o koules.exe $(PROGS_O) $(LIBS) -lm
54	rc os2dive/koules $(PROGS)
55
56koules.res: os2dive/koules.rc os2dive/pm_main.h
57	rc -r os2dive/koules
58
59font.obj: font.c
60	@echo please be patient.
61	@echo the font.c is big and ugly i ripped it from zgv.
62	@echo do you know about better one?
63	$(CC) $(OPTIMIZE1) $(CFLAGS) -c  $<
64
65koules.obj: koules.c os2dive/interface.h
66	$(CC) $(OPTIMIZE1) $(CFLAGS) -Wall -c  $<
67
68menu.obj: menu.c koules.h
69	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  $<
70
71gameplan.obj: gameplan.c koules.h
72	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  $<
73
74intro.obj: intro.c koules.h font.h text.h os2dive/interface.h
75	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  $<
76
77soundos2.obj: soundos2.c sound.h
78	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c $<
79
80os2dive/pm_main.obj: os2dive/pm_main.c os2dive/interface.h \
81  os2dive/input.h os2dive/pm_main.h
82	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  -o os2dive/pm_main.obj $<
83
84os2dive/init.obj: os2dive/init.c ./koules.h os2dive/pm_main.h ./framebuffer.h \
85  os2dive/newbutton.c
86	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  -o os2dive/init.obj $<
87
88os2dive/input.obj: os2dive/input.c ./koules.h os2dive/pm_main.h
89	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  -o os2dive/input.obj $<
90
91framebuffer.obj: framebuffer.c koules.h os2dive/interface.h
92	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  $<
93
94cmap.obj: cmap.c koules.h
95	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  $<
96
97rcfiles.obj: rcfiles.c koules.h
98	$(CC) $(CFLAGS) $(OPTIMIZE) -Wall -c  $<
99
100install:: $(PROG) $(SOUNDSERVER)
101	@echo "Koules directory is " $(BINDIR)
102	@:
103	@echo "Instalin man page to " $(MANDIR)
104	$(INSTALL) -c $(INSTBINFLAGS) koules.svga.6 $(MANDIR);
105	@:
106	@echo "Creating directory " $(BINDIR)
107	@if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
108	$(INSTALL) -c -s $(INSTBINFLAGS) koules.svga $(BINDIR)
109	@:
110	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
111	 then								\
112		echo "Creating directory " $(SOUNDDIR); 		\
113		if [ ! -d $(SOUNDDIR) ]; then mkdir $(SOUNDDIR); fi;    \
114		echo "Copying sound server to directory " $(SOUNDDIR); \
115		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(BINDIR); \
116		echo "Copying sound files into directory " $(SOUNDDIR); \
117		cd ./sounds; set -x;					\
118		for file in *.raw; do					\
119		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(SOUNDDIR);	\
120		done;   						\
121	 fi
122	@echo "Don't forget to remove your old koules from /usr/games/koules "
123	@echo "and /usr/games/kouleslib "
124
125
126clean:
127	rm -f koules $(SOUNDSERVER)
128	rm -f core `find . -name '*.[oas]' -print`
129	rm -f core `find . -name '*~' -print`
130	rm -f core `find . -type f -name 'core' -print`
131
132indent:
133	indent -di16 *.c *.h svgalib/*.c svgalib/*.h xlib/*.c xlib/*.h
134