%.o : %.cpp scripts.h
	g++ -shared -c -Werror -fPIC -O2 $(CFLAGS) $< -o $@

ALL: $(TARGET) patcher

$(TARGET): dan.o dllmain.o engine.o jfwcine.o jfwcust.o jfwdmg.o jfwgame.o jfwhook.o jfwmisc.o jfwpoke.o jfwpow.o jfwscr.o jfwsnd.o jfwveh.o jfwweap.o jfwzone.o jfwobj.o jfwws.o kak.o neo.o nh.o nhp.o ra2.o reborn.o renalert.o scriptfactory.o scriptregistrar.o scripts.o scud.o shawk.o survival.o tda.o tfx.o mdb.o renalert2.o kamuix.o mdbdef.o mdbevf.o
	g++ -shared -ldl $^ -o $@ 

patcher: patcher.c
	gcc -Werror -O2 $(CFLAGS) $< -o $@

dllmain.o: engine.h

dan.o: dan.h engine.h

engine.o: engine.h

jfwcine.o: jfwcine.h

jfwcust.o: jfwcust.h engine.h

jfwdmg.o: jfwdmg.h engine.h

jfwgame.o: jfwgame.h engine.h

jfwhook.o: jfwhook.h engine.h

jfwmisc.o: jfwmisc.h engine.h

jfwpoke.o: jfwpoke.h engine.h

jfwpow.o: jfwpow.h engine.h

jfwscr.o: jfwscr.h engine.h

jfwsnd.o: jfwsnd.h engine.h

jfwveh.o: jfwveh.h engine.h

jfwweap.o: jfwweap.h engine.h

jfwzone.o: jfwzone.h engine.h

jfwgun.o: jfwgun.h engine.h

jfwdef.o: jfwdef.h engine.h

jfwobj.o: jfwobj.h

jfwwws.o: jfwws.h

kak.o: kak.h

neo.o: neo.h engine.h

nh.o: nh.h

nhp.o: nhp.h

ra2.o: ra2.h

nh.o: nh.h

reborn.o: reborn.h

renalert.o: renalert.h engine.h

scud.o: scud.h

shawk.o: shawk.h engine.h

survival.o: survival.h

tda.o: tda.h

tfx.o: tfx.h

mdb.o: mdb.h engine.h mdbevf.h

renalert2.o: renalert2.h engine.h

kamuix.o: kamuix.h engine.h

mdbevf.o: mdbevf.h engine.h

mdbdef.o: mdbdef.h engine.h
