#!/usr/bin/make
# Makefile for coolmail
#
############################################################################
#
# TO BUILD COOLMAIL:
# ------------------
# (1) If necessary, edit CFLAGS, LINK, INCLUDES, LIB_DIRS, and BINDIR.
# (2) Type `make' in this directory to build coolmail.
# (3) Type `make install' in this directory to copy it to your BINDIR.
#
############################################################################

# Uncomment this if CC is not in your environment.  Change it if necessary.
#CC = gcc

# Please verify that the following six lines are correct.  CFLAGS is
# a set of options for your C compiler, LINK is the linker command you
# want to use.  (This may be your C compiler, because most C compilers
# know how to invoke the linker.)  INCLUDES is any include path that your
# compiler should search in addition to its default paths.  LIB_DIRS tells
# your linker where to find the libraries it will need, and BINDIR and
# MANDIR specify the places to install the binary executable and manpage
# files for coolmail when you type `make install'.
CFLAGS   = 
LINK     = $(CC)
INCLUDES = -I/usr/X11R5/include
LIB_DIRS = -L/usr/X11R5/lib
BINDIR   = /usr/local/bin
MANDIR   = /usr/local/man/man1

# Comment these out if you can't or don't want to use the digitized audio
# feature.
AUDIO        = -DAUDIO
AUDIO_MODULE = audio.o

#### You really don't need to read past this point. ####

LIBS  = $(LIB_DIRS) -lXt -lX11 -lm -lXext
COPTS = $(CFLAGS) $(AUDIO)

all: coolmail
	# Done.

new:
	rm -f *.o coolmail core

clean:
	rm -f *.o core

install:
	@if [ -w $(BINDIR) ] ; then \
	   echo "Attempting to install coolmail executable." ; \
	   if [ -f $(BINDIR)/coolmail ] ; then \
	      echo "Existing copy of coolmail will be OVERWRITTEN." ; \
	   fi; \
	   echo "cp coolmail $(BINDIR)/coolmail" ; \
	   cp coolmail $(BINDIR)/coolmail ; \
	else \
	echo "ERROR:  Unable to write to $(BINDIR)." ; \
	   echo "Please check that it exists and that you have write access" ; \
	   echo "to it." ; \
	fi;
	@if [ -w $(MANDIR) ] ; then \
	   echo "Attempting to install coolmail man page." ; \
	   echo "cp coolmail.man $(MANDIR)/coolmail.1" ; \
	   cp coolmail.man $(MANDIR)/coolmail.1 ; \
	   echo "OK.  You may wish to update the whatis database" ; \
           echo "for $(MANDIR)." ; \
	else \
	echo "ERROR:  Unable to write to $(MANDIR)." ; \
	   echo "Please check that it exists and that you have write access" ; \
	   echo "to it." ; \
	fi;

coolmail: coolmail.o display_list.o render1.o colors.o $(AUDIO_MODULE)
	$(LINK) coolmail.o display_list.o render1.o  colors.o $(AUDIO_MODULE)\
                $(LIBS) -o coolmail 

display_list.o: system/X11/display_list.c display_list.h render1.h \
                system/X11/colors.h
	$(CC) $(COPTS) $(INCLUDES) system/X11/display_list.c -c

r1_sub.o: r1_sub.c display_list.h render1.h
	$(CC) $(COPTS) $(INCLUDES) r1_sub.c -c

coolmail.o: coolmail.c mailbox.h render1.h
	$(CC) $(COPTS) $(INCLUDES) coolmail.c -c

render1.o: render1.c display_list.h render1.h
	$(CC) $(COPTS) $(INCLUDES) render1.c -c

colors.o: system/X11/colors.c system/X11/colors.h
	$(CC) $(COPTS) $(INCLUDES) system/X11/colors.c -c

audio.o: audio.c
	$(CC) $(COPTS) $(INCLUDES) audio.c -c


syntax highlighted by Code2HTML, v. 0.9.1