# Makefile for "tuxmath"
# (Hand-coded) RISC OS version

# Bill Kendrick
# bill@newbreedsoftware.com
# 2001.Aug.26 - 2001.Sep.07


CFLAGS=-Wall -O2 $(SDL_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" -DDEBUG \
	-DVERSION=\"$(VERSION)\" -D$(SOUND)SOUND

SDL_CFLAGS=-ISDL: -ISDLExtra:
SDL_LIBS=-LSDL: -LSDLExtra: -lSDL

LIBS=$(SDL_LIBS) $(MIXERLIB) -lSDL_image -ljpeg -lpng -ltiff -lz
MIXERLIB=-lSDL_mixer

DATA_PREFIX=/<TuxMath$$Dir>
BIN_PREFIX=/<TuxMath$$Dir>

VERSION=2001.09.07



all:	tuxmath

nosound:
	make tuxmath SOUND=NO MIXERLIB=

install:
	@echo "COPYING BINARY TO $(BIN_PREFIX)"
	cp tuxmath $(BIN_PREFIX)
	chown root.root $(BIN_PREFIX)/tuxmath
	chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxmath
	@echo "COPYING DATA FILES TO $(DATA_PREFIX)"
	mkdir -p $(DATA_PREFIX)
	cp -r data/* $(DATA_PREFIX)
	chown -R root.root $(DATA_PREFIX)
	chmod -R a+rX,g-w,o-w $(DATA_PREFIX)

clean:
	-rm tuxmath
	-rm obj/*.o
	-rmdir obj


tuxmath:	obj/tuxmath.o obj/setup.o obj/title.o obj/game.o \
		obj/options.o obj/credits.o obj/playsound.o
	@echo "LINKING!"
	$(CC) $(CFLAGS) $^ -o tuxmath $(LIBS)


obj:
	mkdir obj

obj/tuxmath.o:	src/tuxmath.c src/images.h src/sounds.h src/setup.h \
		src/title.h src/game.h src/options.h src/credits.h \
		src/playsound.h
	@echo "BUILDING tuxmath.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/tuxmath.c -c -o obj/tuxmath.o

obj/setup.o:	src/setup.c src/setup.h src/sounds.h src/images.h src/game.h
	@echo "BUILDING setup.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/setup.c -c -o obj/setup.o

obj/title.o:	src/title.c src/title.h src/setup.h src/sounds.h src/images.h \
		src/playsound.h
	@echo "BUILDING title.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/title.c -c -o obj/title.o

obj/game.o:	src/game.c src/game.h src/setup.h src/sounds.h src/images.h \
		src/playsound.h
	@echo "BUILDING game.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/game.c -c -o obj/game.o

obj/options.o:	src/options.c src/options.h src/images.h src/setup.h \
		src/sounds.h src/playsound.h
	@echo "BUILDING options.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/options.c -c -o obj/options.o

obj/credits.o:	src/credits.c src/credits.h src/setup.h src/sounds.h \
		src/images.h
	@echo "BUILDING credits.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/credits.c -c -o obj/credits.o

obj/playsound.o:	src/playsound.c src/playsound.h src/setup.h \
		src/sounds.h
	@echo "BUILDING playsound.o"
	-mkdir obj
	$(CC) $(CFLAGS) src/playsound.c -c -o obj/playsound.o

