# MX Windows 2.0 makefile (C) 2001 Achillefs Margaritis


INCLUDEDIRS = -I. -I$(DJDIR)/include -Iinclude -Isrc
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 lib/libmxwin.a install programs
	@echo All done.
	@echo To use MX-Windows include 'mxwin.h' and link with 'mxwin'


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


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


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


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


lib/libmxwin.a : obj/mxwin.o
	ar rs lib/libmxwin.a obj/_osdep.o obj/mxwin.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\mxwin.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\mxwin.h
	del $(subst /,\,$(DJDIR))\lib\libmxwin.a


