# $Id: Makefile,v 1.9 1996/06/25 21:42:32 oh Exp $
#
# Take look at EXTRA OPTION below
# and also edit config.h file if you need.
# if you don't know what to do, don't worry about it. Just type 'make'

BINDIR=/usr/local/bin
MANDIR=/usr/local/man/man1

CC=gcc

CFLAGS= -g 
#CFLAGS= -O2 -m486 -pipe 
#CFLAGS= -O2 -m486 -fno-strength-reduce -Wall -pipe

#--------------------------------------------------------------
# Valid flags for EXTRA_OPTION
# -DHAVEMDA		- if you want to enable -m flag MDA.
# -DHAVEPROCMAIL	- if you want to enable -p flag 
#                         procmail support.
# -------------------------------------------------------------
# Log file preference
# -DLogShowfrom		- Shows From: and Subject: lines 
#			  of fetched messages in logging. 
# -DLogOnlyNew		- logging to a file only when there is
#                         new mails. don't log when there is no new mails. 
#                         Useful if you want to use biff or xmailbox
#                         with fetchpop.
#--------------------------------------------------------------
# For example,

#EXTRA_OPTION = 
#EXTRA_OPTION = -DHAVEMDA -DLogShowfrom 
#EXTRA_OPTION = -DHAVEPROCMAIL -DLogShowfrom 
EXTRA_OPTION = -DHAVEPROCMAIL -DHAVEMDA -DLogShowfrom -DLogOnlyNew 
#EXTRA_OPTION = -DHAVEPROCMAIL -DHAVEMDA -DLogShowfrom  

LIBS=

# -------- No need to edit anything below here ---------------------------
DEFTARGET=notes
OBJECTS=fetchpop.o pop.o retrieve.o socket.o 
start: $(DEFTARGET)
notes: 
	@echo "Did you check config.h?"
	@echo "If you did, just type:"
	@echo ""
	@echo "   make fetchpop       compile fetchpop."
	@echo "   su root"
	@echo "   make install        install the fetchpop and the man page."
	@echo "------------------------------------------------------------"
	@echo "   make all            compile both fetchpop and truncate."
	@echo "   make truncate       compile trucate."
	@echo "   make install.truncate  install truncate and the man page"
	@echo "   make clean          clean up object files."
	@echo "   make distclean      clean up everything except source codes"
all: fetchpop truncate
fetchpop: $(OBJECTS)
	$(CC) $(CFLAGS) ${EXTRA_OPTION} $(OBJECTS) -o fetchpop $(LIBS)
truncate: truncate.c
	$(CC) $(CFLAGS) truncate.c -o truncate
.c.o:
	$(CC) $(CFLAGS) ${EXTRA_OPTION} -c $<
fetchpop.o: fetchpop.c fetchpop.h config.h pop.h retrieve.h socket.h
pop.o: pop.c socket.h fetchpop.h config.h pop.h retrieve.h
retrieve.o: retrieve.c retrieve.h pop.h config.h
socket.o: socket.c socket.h 
install:
	install -c -s -m 0755 fetchpop $(BINDIR)
	install -c -m 0444 fetchpop.1L $(MANDIR)
install.truncate:
	install -c -s -m 0755 truncate $(BINDIR)
	install -c -m 0444 truncate.1L $(MANDIR)
clean:
	rm -f $(OBJECTS)
	rm -f core 
distclean:
	rm -f fetchpop truncate
	rm -f $(OBJECTS)
	rm -f core *~ 
