CPP         = g++

CFLAGS      = -Wall -O3
LFLAGS      = -mwindows -lalleg
	
EXE         = ../spaceinvaders.exe

SRC = $(wildcard *.cpp)
OBJ = $(SRC:.cpp=.o)

.PHONY: clean

$(EXE): $(OBJ)
	wfixicon icon.ico -ro -d ../dat.dat ICON PAL
	gcc -o $@ *.o icon.res $(LFLAGS)

%.o: %.cpp
	$(CPP) $(CFLAGS) -c -o $@ $<

clean:
	rm -f *.o *.res
	
ashot.o: ashot.cpp main.h dat.h common.h game.h unit.h defender.h \
 entity.h attacker.h ashot.h shot.h defense.h explosion.h
attacker.o: attacker.cpp main.h dat.h common.h attacker.h entity.h \
 ashot.h explosion.h defense.h game.h unit.h defender.h shot.h
defender.o: defender.cpp main.h dat.h common.h defender.h entity.h \
 shot.h ashot.h attacker.h lander.h explosion.h
defense.o: defense.cpp main.h dat.h common.h defense.h entity.h
entity.o: entity.cpp entity.h common.h
explosion.o: explosion.cpp main.h dat.h common.h explosion.h entity.h
game.o: game.cpp game.h common.h unit.h defender.h entity.h attacker.h \
 ashot.h shot.h main.h dat.h defense.h explosion.h lander.h
lander.o: lander.cpp main.h dat.h common.h lander.h entity.h ashot.h \
 explosion.h game.h unit.h defender.h attacker.h shot.h
main.o: main.cpp main.h dat.h common.h ticker.h unit.h game.h \
 defender.h entity.h attacker.h ashot.h shot.h
shot.o: shot.cpp main.h dat.h common.h shot.h entity.h attacker.h \
 defense.h explosion.h lander.h
ticker.o: ticker.cpp ticker.h common.h	
