# Makefile for M7:R under DJGPP (Allegro/DOS/DJGPP). 
# 2000-02-21: K31 wuz here!

# comment this definition if you are not using a pentium-ready gcc.
PGCC=1

CC = gcc
RM = del 
ZIP = pkzip
CX = copy
DJP = djp.exe

#LIBDIR=.\\lib\\

WFLAGS = -Wall -W -Werror -Wno-unused

DFLAGS = -g

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

#LFLAGS = -L.\lib -lfoox -lalleg
LFLAGS = -L. -lfoox -lalleg

#flags for generating .o files from source.
CFLAGS = $(DFLAGS) $(WFLAGS) $(OFLAGS)

# targets.

all : libfoox.a dr.exe

#>>>    All of the supporting modules.
FOOXOBJ = foolib.o sma.o mjedi.o flist.o keylib.o \
idex.o screen.o rend2x.o
#<<<

# .exe thingy
FSEXOBJS = dr.o mm.o jedi2.o
dr.exe :  $(FSEXOBJS)  libfoox.a
	gcc $(LDFLAGS) $(DFLAGS) -o dr.exe $(FSEXOBJS) $(LFLAGS)

# .a thingies --- Libraries

libfoox.a : $(FOOXOBJ)
	ar rs libfoox.a $(FOOXOBJ)
#	$(MV) libfoox.a $(LIBDIR)libfoox.a

# .zip files
# FSE-X binary distro
zippy : all
	-$(RM) m7rs.zip
	$(ZIP) m7rs.zip char.rom *.c *.h *.txt makefile *.bat

binzip: all 
	-$(DJP) dr.exe
#	-$(RM) m7rb.zip	
	$(ZIP) m7rb.zip dr.exe char.rom

# compiling
.c.o:
	@-echo "Making component -> $*.o"
	$(CC) $(CFLAGS) -c $<

# phony [ethical?]
.phony clean :
	-$(RM) *.o 
	-$(RM) *.a
	-$(RM) *.log
	-$(RM) *.exe
