#--------------------------
# MultiMail Makefile (top)
#--------------------------

# CURS_INC specifies the location of your ncurses header file. Broken
# brackets (<, >) should be preceded by backslashes. Quotes (") should
# be preceded by *three* backslashes:

# Default:
CURS_INC = \<ncurses/curses.h\>

# Example with quotes (relative pathnames start from ./interface):
#CURS_INC = \\\"../../ncurses-4.1/include/curses.h\\\"

# CURS_LIB specifies the directory where the ncurses libraries can be found,
# if they're not in the standard search path. "." (the current directory) is
# used here as a placeholder:

# No extras:
CURS_LIB = .

# Example:
#CURS_LIB = ../ncurses-4.1/lib

# LIBS lists any "extra" libraries that need to be linked in:

LIBS = -lncurses

# PREFIX is the base directory under which to install the binary and man 
# page; generally either /usr/local or /usr (or perhaps /opt...):

PREFIX = /usr/local

# OPTS are passed to mmail/Makefile and interface/Makefile:

# With debug:
#OPTS = -g -Wall -pedantic

# Optimized, no debug:
OPTS = -O2 -Wall -pedantic

#--------------------------------------------------------------

all:
	cd mmail; $(MAKE) OPTS="$(OPTS)" mm.a
	cd interface; $(MAKE) OPTS="$(OPTS)" CURS_INC="$(CURS_INC)" interface.a
	$(MAKE) mm

mm:	interface/interface.a mmail/mm.a
	$(CXX) -o mm interface/interface.a mmail/mm.a -L$(CURS_LIB) $(LIBS)

dep:
	cd interface; $(MAKE) CURS_INC="$(CURS_INC)" dep
	cd mmail; $(MAKE) dep

clean:
	rm -f mm
	cd interface; $(MAKE) clean
	cd mmail; $(MAKE) clean

install:
	install -c -s mm $(PREFIX)/bin
	install -c -m 644 mmail.1 $(PREFIX)/man/man1
