# ML generic Makefile
# Use if you have a broken or missing xmkmf/imake


# Set the following to include all of
# 1. Standard includes (/usr/include)
# 2. X11 includes      (parent of X11 include tree)
# 3. Motif includes    (parent of Xm (Motif) include tree)
# 4. The ML "src" directory  "-I."
# 5. The ML "base" directory "-I../"
#    ...Some of these may be covered by other entries


ALL_INCLUDES= -I/usr/include -I. -I../

# The ML support directory. Change here and in ml.h

ML_LIBDIR=/usr/local/lib/ml

#   Compile time defines:
#	-DFALLBACK       Generate an in-memory copy of the app-defaults
#		         resources. Allows the program to configure
#			 itself if no app-defaults are available.
#			 See README.install for more info.
#	-Dconst=         If you have a non-ANSI C compiler, include this.
#	-DSTRICT_BSD     Use if you have no POSIX style dirent.h and
#			 use index and rindex instead of strchr and strrchr.
#                        This hasn't yet been tested.
#	-DNO_EDITRES     If you have no Xmu/Editres.h

CC=cc
CFLAGS= -g -Dconst= -DFALLBACK $(ALL_INCLUDES)

# Add any linker flags here.

PRELINKOPTS= -L/usr/lib/X11

# These libs are added in after everything else; no telling what you
# might need. -lrpcsvc, -lsocket, -lauth, -lgen, -lflitzbaq
# You may just have to wait and see what the linker complains about.
# But look at your c-client Makefile and add in anything that it 
# required. Chances are good we will require it too.

POSTLINKOPTS=

# Where is the Motif library?
# If you are building under Motif2.0, you may also need to add -lXpm

XMLIB=    /usr/lib/libXm.a

# Where are the standard X libraries? (Perhaps the dir is in PRELINKOPTS)

XMULIB=   -lXmu
XTOOLLIB= -lXt
XEXTLIB=  -lXext
XLIB=     -lX11

# Where is the c-client library?

LOCAL_LIBRARIES = ../imap-4/c-client/c-client.a

LDFLAGS= $(PRELINKOPTS) $(LOCAL_LIBRARIES) $(XEWLIB) $(XMLIB) $(XMULIB) \
	$(XTOOLLIB) $(XEXTLIB) $(XLIB) $(POSTLINKOPTS)

FONTSIZE=12

# Installation paths. See ML_LIBDIR above also.

BINDIR=/usr/bin/X11
APPDIR=/usr/lib/X11/app-defaults


# ---  End of configuration  --------------

HELP_FILES=`find ../lib -type f -print`

SRCS=	addresses.c \
	authenticate.c \
	buttons.c \
	compose.c \
	filter.c \
	files.c \
	hostconf.c \
	icon.c \
	imapfncs.c \
	log.c \
	logical.c \
	mailboxes.c \
	mime.c \
	ml.c \
	msgfncs.c \
	notefncs.c \
	preferences.c \
	read.c \
	resources.c \
	system.c \
	textfncs.c \
	view.c \
	winfncs.c

OBJS=	addresses.o \
	authenticate.o \
	buttons.o \
	compose.o \
	filter.o \
	files.o \
	hostconf.o \
	icon.o \
	imapfncs.o \
	log.o \
	logical.o \
	mailboxes.o \
	mime.o \
	ml.o \
	msgfncs.o \
	notefncs.o \
	preferences.o \
	read.o \
	resources.o \
	system.o \
	textfncs.o \
	view.o \
	winfncs.o

PROGRAM = ml

all:: ml

$(OBJS): prototypes.h


resources.o: resources.time

prototypes.h:	prototypes.time

resources.c:	resources.time


ml: $(OBJS) $(LOCAL_LIBRARIES)
	$(CC) -o $@ $(OBJS) $(LDFLAGS)

resources.time: ../lib/ML.ad.ORIG Makefile
	@cp resources.c resources.c.backup
	@../aux/newresources.sh $(FONTSIZE)
	@touch resources.time

prototypes.time: $(SRCS) makeproto
	@cp prototypes.h prototypes.h.backup
	@../aux/newproto.sh
	@touch prototypes.time

makeproto:	../aux/makeproto.c
	$(CC) -o makeproto ../aux/makeproto.c

clean:
	-rm -f *.o core ml

install:
	install -c 0755 ml $(BINDIR)
	install -c 0644 ../lib/ML.ad $(APPDIR)/ML
	-mkdir $(ML_LIBDIR)
	@echo 'Backing up any current config files...'
	@if [ -f $(ML_LIBDIR)/mime.handlers ]; \
	then mv $(ML_LIBDIR)/mime.handlers $(ML_LIBDIR)/mime.handlers.OLD; \
	fi
	@echo "Copying lib files..."
	@cp $(HELP_FILES) $(ML_LIBDIR)
	@echo "Done."









syntax highlighted by Code2HTML, v. 0.9.1