# Makefile for UnZip 5.11 and later:  Human68K with gcc        NIIMI Satoshi
#
# The original Makefile maybe works fine, but X68000 is too slow
# to process it.  So I split out needed part.
#
# Last revised:  10 Jul 94

VPATH = HUMAN68K

CC = gcc
CFLAGS = -Wall -O -I. -fomit-frame-pointer -fstrength-reduce
LDFLAGS = -s

LIBS = -lsignal -ldos -lmb

# UnZipSFX flags
XC = -DSFX

# fUnZip flags
FC = -DFUNZIP

# object files
OBJS = unzip.o crypt.o envargs.o explode.o extract.o file_io.o inflate.o \
	match.o unreduce.o unshrink.o zipinfo.o human68k.o options.o
OBJX = unzipsfx.o crypt.o extract_.o file_io.o inflate.o match.o human68_.o
OBJF = funzip.o crypt_.o inflate_.o

UNZIPS = unzip.x unzipsfx.x funzip.x

.c.o:
	$(CC) $(CFLAGS) -I. -c $< -o $@

# for debugging
.c.s:
	$(CC) $(CFLAGS) -c $< -o $@

all:		unzips
unzips:		$(UNZIPS)
docs:		$(DOCS)
unzipsman:	unzips docs
unzipsdocs:	unzips docs

clean:
	rm -f $(OBJS) $(OBJF) $(OBJX) $(UNZIPS)

unzip.x: $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

unzipsfx.x: $(OBJX)
	$(CC) $(LDFLAGS) -o $@ $(OBJX) $(LIBS)

funzip.x: $(OBJF)
	$(CC) $(LDFLAGS) -o $@ $(OBJF) $(LIBS)

crypt.o:	crypt.c unzip.h zip.h crypt.h
envargs.o:	envargs.c unzip.h
explode.o:	explode.c unzip.h
extract.o:	extract.c unzip.h crypt.h
file_io.o:	file_io.c unzip.h crypt.h tables.h
funzip.o:	funzip.c unzip.h crypt.h tables.h
inflate.o:	inflate.c inflate.h unzip.h
match.o:	match.c unzip.h
unreduce.o:	unreduce.c unzip.h
unshrink.o:	unshrink.c unzip.h
unzip.o:	unzip.c unzip.h crypt.h version.h
zipinfo.o:	zipinfo.c unzip.h

crypt_.o:	crypt.c unzip.h zip.h crypt.h		# used by funzip
	$(CC) $(CFLAGS) $(FC) -c $< -o $@

extract_.o:	extract.c unzip.h crypt.h		# used by unzipsfx
	$(CC) $(CFLAGS) $(XC) -c $< -o $@

human68k.o:	human68k/human68k.c unzip.h
	$(CC) $(CFLAGS) -I. -c human68k/human68k.c -o $@

human68_.o:	human68k/human68k.c unzip.h		# used by unzipsfx
	$(CC) $(CFLAGS) $(XC) -I. -c human68k/human68k.c -o $@

inflate_.o:	inflate.c inflate.h unzip.h crypt.h	# used by funzip
	$(CC) $(CFLAGS) $(FC) -c $< -o $@

unzipsfx.o:	unzip.c unzip.h crypt.h version.h	# used by unzipsfx
	$(CC) $(CFLAGS) $(XC) -c $< -o $@

diff:
	-(cd ..; diff -cNr unz51f unz51f-x68k -x GNUmakefile -x "*.[ox]" > unzip68k.dif)
