##############################################################################
# FILE:		Makefile
# AUTHOR:	Terry Weissman : Taken over by Paul Sharpe.
##############################################################################

# "make" -or- "make all"     - creates decxmail with no symbols.
# "make debug" 		      - creates decxmail with symbols, using Xlib 
#				with symbols.
# "make alldebug"   	      - creates decxmail with symbols, but uses Xlib
#				without symbols.
# "make local"		      - as above, but also installs the local
#				application-defaults file.

##############################################################################
# CONFIGURATION SECTION: configure these definitions for your environment.
# $Header: [Makefile,v 1.3.1.4 92/10/15 11:29:53 rspinney Exp ]$

DESTROOT=
CONFDIR = /usr/bin

INCDIR = ${DESTDIR}/usr/include
LIBDIR = ${DESTDIR}/usr/lib

# Digital Document Interchange Facility libraries.
DWTLIB= $(DESTDIR)/usr/lib/libdwt.a
XLIB= $(DESTDIR)/usr/lib/libX11.a
DDIFLIB= /usr/lib/libddif.a
DVRLIB= $(DVRROOT)/usr/lib/libdvr.a
DVSLIB= /usr/lib/libdvs.a
IDSLIB= $(ISLROOT)/usr/lib/libids.a
IMGLIB= $(ISLROOT)/usr/lib/libimg.a
CHFLIB= $(ISLROOT)/usr/lib/libchf.a
DDIFLIB_MACRO=  $(DVRLIB) $(IDSLIB) $(DWTLIB) $(IMGLIB) $(CHFLIB) $(XLIB) $(DVSLIB) $(DDIFLIB)
 
# The CAPSAR library: /usr/lib/libcapsar.a or -lcapsar
CAPSARLIB = ${CAPSARROOT}/usr/lib/libcapsar.a

# The lint output for the assorted libraries used in dxmail.
# Set empty if you do not have any.
LINTLIBS = 

# Set this to 'strip' if you want small executables with no symbol table for
# the 'make all', no-debug option.
# Otherwise, set to something like 'touch' or 'ls -l'
STRIP = ls -l

# DO_DEBUG	if you want debug messages appearing to fflushed STDOUT, in
# 		conjunction with the 'debug' Xdefault.
# APPDEFAULT	the filename in /usr/lib/X11/app-defaults in which are stored
# 		the default application resources: it is only used in init.c
# VFORK		use the faster, more efficient vfork() instead of fork(), but
#		no guarantees: vfork() is not widely liked...
DEFINES= -DAPPDEFAULT=\"Mail\" -DDO_DEBUG

# END OF CONFIGURATION SECTION.
##############################################################################

OPTFLAG   = -g
INCLUDES  = -I. -I${DESTDIR}/usr/include/X11 -I${DESTDIR}/usr/include -I../../lib/dwt -I${DDIFROOT}/usr/include
CFLAGS    = ${OPTFLAG} ${INCLUDES} ${DEFINES}
LIBS	  = ${DDIFLIB_MACRO} ${CAPSARLIB} -lm
DEBUGLIBS = $(DDIFLIB_MACRO) $(CAPSARLIB) -lm

.c.o:
	$(CC) -c ${CFLAGS} $*.c

OBJS =  Column.o EDiskSrc.o Pane.o ScrollW.o actions.o button.o command.o compfuncs.o customize.o folder.o icon.o init.o main.o menus.o mlist.o msg.o pick.o popup.o radio.o screen.o toc.o tocfuncs.o tocout.o tocutil.o tsource.o util.o version.o viewfuncs.o widgetinfo.o

##############################################################################
# Create an object with no symbols whatsoever...
all:	decxmail

# Create an object with ONLY LOCAL symbols.
debug:
	make decxmail OPTFLAG=-g

# Create an object with AS MANY symbols as possible.
alldebug:
	make decxmail_d OPTFLAG=-g

##############################################################################
# Object from non-symbol libraries.
decxmail: $(OBJS)
	$(CC) -o $@ ${OPTFLAG} $(OBJS) $(LIBS)
	-cp -f $@ z$@
	${STRIP} $@

# Object from symbol libraries.
decxmail_d: $(OBJS)
	rm -f decxmail_d
	$(CC) -o $@ ${OPTFLAG} $(OBJS) ${DEBUGLIBS}

##############################################################################
main.o: main.c globals.h

msg.o toc.o tocout.o tocutil.o tsource.o: tocintrnl.h

##############################################################################
local: decxmail install

installlocla:
	cp Mail /usr/lib/X11/app-defaults/Mail

install: decxmail
	install -c -m 755 decxmail ${DESTDIR}/${CONFDIR}/dxmail
	install -c -m 0644 Mail ${DESTDIR}/usr/lib/X11/app-defaults/Mail
	install -c -m 0644 MailScanFormat ${DESTDIR}/usr/lib/X11/app-defaults/MailScanFormat


##############################################################################
lint: decxmail
	lint -bzv ${DEFINES} ${INCLUDES} *.c

alllint: decxmail
	lint -bzv ${DEFINES} ${INCLUDES} *.c ${LINTLIBS}
##############################################################################
clean:
	rm -f *.o decxmail *.out

clobber: clean
	-if [ -d RCS ]; then \
		rm -f *.c *.h Makefile; \
	else true; \
	fi

##############################################################################

DEPEND= ../../makedepend/makedepend

depend:
	${DEPEND} -v -I. ${CFLAGS} -s'# DO NOT DELETE' *.c

# DO NOT DELETE THIS LINE --- make depend depends on it.
