#Edit SRCDIR to the location of where amgc2 and it's source directory is
#After compiling copy the files to  amgc2/games/mdefend or run one of the install targets

SRCDIR=

ifeq ($(SRCDIR),)
$(error Edit the makefile and point the SRCDIR variable to the amgc2 directory)
endif

all:
	$(error Specify a target. make win | make linux | make win-install | make linux-install  )

win: mdefend.cpp
	g++ -o mdefend.dll mdefend.cpp -shared -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -s -W -Wall -I$(SRCDIR)\src -lalleg

linux:
	g++ -o mdefend.so  mdefend.cpp -shared -s -fPIC -W -Wall -I$(SRCDIR)/src `allegro-config --libs`

win-install: win
	-mkdir $(SRCDIR)\games\mdefend
	-copy mdefend.dat $(SRCDIR)\games\mdefend
	-copy mdefend.bmp $(SRCDIR)\games\mdefend
	-copy mdefend.so $(SRCDIR)\games\mdefend

linux-install: linux
	-mkdir $(SRCDIR)/games/mdefend
	-cp mdefend.dat $(SRCDIR)/games/mdefend
	-cp mdefend.bmp $(SRCDIR)/games/mdefend
	-cp mdefend.so $(SRCDIR)/games/mdefend

.PHONY: all win linux win-install linux-install
