# Makefile
#-----------------------------------------------------------------------------
# Abstract:
#    Makefile for mimelite, a simple C library to handle charset folding
#    (including MIME).
#
# Design:
#    This Makefile will work under Unix, and with Borland's make. I haven't
#    understood how I can get anything to work with Microsoft's make.
#
#    Assumes that some DOS utilities (i.e. make, pkzip, shar) are clever
#    enough to understand Unix subdirectory separator (/).
#
#    To make the mimelite library on a particular platform, set/remove
#    comments in the "customization section" below.  Also, edit the
#    directories etc. so things install in the right places.
#
# Targets:
#    - all     : build program
#    - shar    : Unix shar archive (source distribution)
#    - zip     : MSDOS zip archive (source + UNMIME.EXE)
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
#                        START OF CUSTOMIZATION SECTION
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Borland C
CC	= bcc
CFLAGS	= -w-pia -w-def -w-eff
LFLAGS	= -e$@
EXE	= .exe
OBJ	= .obj
RM	= rm -f
ZIP	= \bin\arc\zip
UNZIP	= \bin\arc\pkunzip
ZFLAGS	= -o
RMISC	=

# UNIX
#CC	= gcc
#CFLAGS	= -g
#LFLAGS	= -o $@
#EXE	=
#OBJ	= .o
#RM	= \rm -f
#ZIP	= /local/bin/zip
#ZIP	= /local/bin/unzip
#ZFLAGS	= -o
#RMISC	= *~

# Uncomment to create demonstrators display folding operation.
#VERBOSE = -DSHOWFOLD

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#                         END OF  CUSTOMIZATION SECTION
#-----------------------------------------------------------------------------

VER	= 20
SRC	= mimelite.h fold.c import.c export.c demoimp.c demoexp.c unmime.c

.c.obj:
	$(CC) -c $(CFLAGS) $(VERBOSE) $<

.c.o:
	$(CC) -c $(CFLAGS) $(VERBOSE) $<

all:		demoexp$(EXE) demoimp$(EXE) unmime$(EXE)

demoexp$(EXE):	demoexp$(OBJ) export$(OBJ)  fold$(OBJ)
	$(CC) $(LFLAGS) demoexp$(OBJ) export$(OBJ) fold$(OBJ)

demoimp$(EXE):	demoimp$(OBJ) import$(OBJ) fold$(OBJ)
	$(CC) $(LFLAGS) demoimp$(OBJ) import$(OBJ) fold$(OBJ)

unmime$(EXE):	unmime$(OBJ)  import$(OBJ) fold$(OBJ)
	$(CC) $(LFLAGS) unmime$(OBJ)  import$(OBJ) fold$(OBJ)

fold$(OBJ):	fold.c	  mimelite.h
export$(OBJ):	export.c  mimelite.h
import$(OBJ):	import.c  mimelite.h
demoexp$(OBJ):	demoexp.c mimelite.h
demoimp$(OBJ):	demoimp.c mimelite.h
unmime$(OBJ):	unmime.c  mimelite.h

#---( housekeeping )----------------------------------------------------------

clean:
	-$(RM) *$(OBJ) demoimp$(EXE) demoexp$(EXE) unmime$(EXE) mimelt$(VER).zip mimelite.shr $(RMISC)

zip:	AAREAD.ME file_id.diz mimelite.doc tutorial.txt Makefile $(SRC) iso8859.ps unmime.exe
	-$(RM) mimelt$(VER).zip
	$(ZIP) $(ZFLAGS) mimelt$(VER).zip AAREAD.ME file_id.diz mimelite.doc tutorial.txt
	$(ZIP) $(ZFLAGS) mimelt$(VER).zip Makefile $(SRC) unmime.exe
	$(ZIP) $(ZFLAGS) mimelt$(VER).zip iso8859.ps
	$(UNZIP) -v mimelt$(VER).zip

#Unix only
shar:	AAREAD.ME file_id.diz mimelite.doc tutorial.txt Makefile $(SRC) iso8859.ps
	$(RM) mimelite.shr
	shar AAREAD.ME file_id.diz mimelite.doc tutorial.txt Makefile $(SRC) iso8859.ps > mimelite.shr

# EOF
