#
# Makefile for m1 w/ minit...

# uncomment this definition if you are using PGCC!
#PGCC=1

CC = gcc
RM = del
ZIP = pkzip
CX = copy

EXPDIR = E:\newlook\

#OBJ = obj/djgpp
#LIBDEST = $(KEIDIR)/lib/
DJP = $(DJDIR)/bin/djp.exe

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

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

#CFLAGS = -I. -I$(OBJ) $(WFLAGS) $(OFLAGS)
CFLAGS = -I. $(WFLAGS) $(OFLAGS)


# targets.


all : m1 pack

m1 : m1.o minit.o
	$(CC) m1.o minit.o -o m1.exe -lalleg
pack: m1
	$(DJP) m1.exe


distclean : veryclean
veryclean : spank
# as in "Spanking clean"
spank : clean
	$-echo "Cleaning up executable files..."
	$(RM) m1.exe
	$-echo "Done. Now the place looks spanking clean!"

clean :
	$-echo "Cleaning up object files..."
	$(RM) *.o
	$-echo "Done claning unnecessary object files."

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

# now for the zip files

dist : zip
# dist is for distribution. note that log files are not included,
# as they only contain either (1) debugging info or (2) random personal
# thought about the project.

zip : srczip binzip datzip

datzip :
	$(ZIP) charset.zip char.rom

binzip : 
	$(ZIP) m1b.zip m1.exe readme.txt usage.txt testin.txt char.rom

srczip :
	$(ZIP) m1s.zip *.c *.h *.txt makefile

# exporting to newlook...
exbin : binzip
	$(CX) m1b.zip $(EXPDIR)

exsrc : srczip
	$(CX) m1s.zip $(EXPDIR)

exdat : datzip
	$(CX) charset.zip $(EXPDIR)

export : exall
exall : exbin exsrc exdat

# dependencies go here. Do not delete!!!

m1.o: m1.c
minit.o: minit.c

# zip dependancies. I now love GNU make. It's touchy but stable.

datzip : char.rom
binzip : m1.exe readme.txt usage.txt
srczip : *.c *.h *.txt makefile

# I can use make!!! Muhahahhaha!