# MX Windows makefile (C) 1999 Achillefs Margaritis


INCLUDEDIRS = -I. -I$(DJDIR)/include/allegro.h -Iinclude
LIBDIRS = -L$(DJDIR)/lib


ifdef PGCC
OFLAGS = -mpentium -O6 -ffast-math -fomit-frame-pointer
else
OFLAGS = -m486 -O3 -ffast-math -fomit-frame-pointer
endif


ifdef DEBUGMODE
CFLAGS = $(INCLUDEDIRS) -Wall -g3 -m386
else
CFLAGS = $(INCLUDEDIRS) -Wall $(OFLAGS) -s
endif


all : msg obj/mx.o lib/libmxwin.a install programs
	@echo All done.
	@echo To use MX-Windows include 'mx.h' and link with 'mxwin'


compile : include/mx.h src/mx.c obj/mx.o msg lib/libmxwin.a
	@echo All done.
	@echo To use MX-Windows include 'mx.h' and link with 'mxwin'


msg :
	@echo Compiling MX-Windows. Please wait...


lib/libmxwin.a : obj/mx.o
	ar rs lib/libmxwin.a obj/mx.o 


obj/mx.o : include/mx.h src/mx.c
	gcc -c $(CFLAGS) src/mx.c -o obj/mx.o


clean :
	@echo Cleaning up...
	del obj\*.o
	del lib\*.a
	del examples\*.o
	del examples\*.exe


install :
	@echo Installing under DJGPP directories...
	copy include\mx.h $(subst /,\,$(DJDIR))\include
	copy lib\libmxwin.a $(subst /,\,$(DJDIR))\lib


programs :
	@echo Compiling and linking examples...
	cd examples
	make
	cd ..


uninstall : clean
	@echo Uninstalling...
	del $(subst /,\,$(DJDIR))\include\mx.h
	del $(subst /,\,$(DJDIR))\lib\libmxwin.a


