# Copyright 1994/95 Alex Hornby. All Rights Reserved. See file README for 
# details.

version=0.1a
BINDIR=/usr/local/games
LIBDIR=/usr/local/lib/zapem

# Uncomment this if the game runs too fast
fast= #-DFAST

# Uncomment this for joystick control
joystick=  #-DJOYSTICK

options = $(joystick) $(fast)  
cflags = $(options) -m486 -O2
objs =  alopen.o screen.o starfield.o rnd.o asmblock.o animation.o sprite.o\
	control.o Joystick.o Keyboard.o player.o font.o block.o gamelib.o main.o gif.o
target = zapem

all: $(target)

install: $(target) 
	install -s -m6755 $(target) $(BINDIR)
	install -m755 -d $(LIBDIR)
	install -m755 invsprit.gif $(LIBDIR)
	install -m755 font.gif $(LIBDIR)

package: clean
	cd .. && tar cvf - zapem | gzip -9 > zapem-$(version).tgz

$(target) : $(objs)
	g++ $(cflags) -o $(target) $(objs) -lvga

main.o : main.cc sprite.h 
	g++ $(cflags) -c main.cc

alopen.o:
	g++ $(cflags) -c alopen.cc

Keyboard.o : Keyboard.cc
	g++ $(cflags) -c Keyboard.cc

Joystick.o : Joystick.cc Joystick.h
	g++ $(cflags) -c Joystick.cc

control.o : control.cc control.h
	g++ $(cflags) -c control.cc

rnd.o : rnd.c
	g++ $(cflags) -c rnd.c

starfield.o : starfield.cc screen.h starfield.h
	g++ $(cflags) -c starfield.cc

screen.o: screen.cc screen.h
	g++ $(cflags) -c screen.cc		

player.o : sprite.h player.h player.cc
	g++ $(cflags) -c player.cc

font.o : font.cc
	g++ $(cflags) -c font.cc

sprite.o : sprite.h asmblock.h animation.h animation.cc sprite.cc
	g++ $(cflags) -c sprite.cc

animation.o : animation.h animation.cc
	g++ $(cflags) -c animation.cc

block.o : block.h asmblock.h block.cc
	g++ $(cflags) -c block.cc

gamelib.o : gamelib.h gamelib.S
	g++ $(cflags) -c gamelib.S

asmblock.o : asmblock.h asmblock.cc
	g++ $(cflags) -c asmblock.cc

gif.o : gif.h gif.cc
	g++ $(cflags) -c gif.cc

clean :
	rm -f *.o $(target)
