# Installation directory...
INSTDIR	= ${PREFIX}
# Where to install the program itself...
BINDIR 	= ${INSTDIR}/bin
# Where to put the man page...
# Note that it is assumed that MANDIR will have a man1 sub-directory!
MANDIR 	= ${INSTDIR}/man
# The place to make this public...
SHIPDIR	= /pub/xmitBin

# This is where all the temporary files will get created...
TEMP_DIR	= /tmp
# ...define "SysVMail" if you want to use System V mailing protocols...
# (NOTE!  This also applies to "sendmail" and "ELM" usage!)
# This option when used with "sendmail" provides the greatest amount of
# xmitBin functionality, so it's the default...
# CCOPTS 	= -DSysVMail
# ...BSD mailing on a BSD system...
# CCOPTS	=
# ...you might also want to define "SYSV" if you're on a System V machine
# (currently, the only difference is in using "getcwd" vs. "getwd" - use
#  this define if "getwd" is undefined)...
# CCOPTS 	= -DSYSV
# ...of course, you could do both, too!
# CCOPTS 	= -DSYSV -DSysVMail
# ...options for gcc on a Linux 386/486 system...
# CCOPTS	= -06 -m486 -Wall -DSYSV -DSysVMail
# ...options for SCO UNIX...
# CCOPTS	= -DSCO -DSYSV
# ...options for Apollo...
# CCOPTS	= -DAPOLLO -DSysVMail
# ...options for FreeBSD...
CFLAGS		?= -O -pipe
CCOPTS		= ${CFLAGS}
CCOPTS		+= -DSysVMail

#
# END OF USER-CONFIGURABLE ITEMS - NO MODIFICATIONS BEYOND THIS POINT SHOULD
# BE NECESSARY!
#

OBJS	= xbmain.o xbfile.o xbutil.o xbanon.o
TARGET	= xmitBin
XMITVERS = 1.9

all: ${TARGET}

clean:
	rm -f ${TARGET} ${OBJS}

install: ${BINDIR}/${TARGET} ${MANDIR}/man1/${TARGET}.1 extras

${BINDIR}/${TARGET}: ${TARGET}
	install -c -s -o root -g wheel -m 111 ${TARGET} ${BINDIR}/${TARGET}

${MANDIR}/man1/${TARGET}.1: ${TARGET}.1
	install -c -m 644 -o bin -g bin ${TARGET}.1 ${MANDIR}/man1/${TARGET}.1

extras:	mailbin postbin
	install -c -o root -g wheel -m 755 mailbin ${BINDIR}/mailbin
	install -c -o root -g wheel -m 755 postbin ${BINDIR}/postbin
	install -c -d -o bin -g bin -m 755 ${INSTDIR}/lib/xmitBin
	install -c -o root -g wheel -m 755 autoSend ${INSTDIR}/lib/xmitBin/autoSend
	install -c -o root -g wheel -m 644 doList.awk ${BINDIR}/doList.awk
	install -c -o root -g wheel -m 644 mkList.awk ${BINDIR}/mkList.awk
	install -c -o bin -g bin -m 644 autoSend.txt ${INSTDIR}/lib/xmitBin/autoSend.txt
	install -c -o bin -g bin -m 644 anonymous.anondat ${INSTDIR}/lib/xmitBin/anonymous.anondat

${TARGET}: ${OBJS}
	${CC} -o ${TARGET} ${OBJS}

xbmain.o: xbmain.c xbcomm.h
	${CC} -c ${CCOPTS} -DTMPDIR='"${TEMP_DIR}"' -DxmitBinRev='"${XMITVERS}"' xbmain.c

xbfile.o: xbfile.c xbcomm.h
	${CC} -c ${CCOPTS} xbfile.c

xbanon.o: xbanon.c xbcomm.h
	${CC} -c ${CCOPTS} xbanon.c

xbutil.o: xbutil.c xbcomm.h
	${CC} -c ${CCOPTS} xbutil.c

# autoSend-specific stuff
ASinstall: ${BINDIR}/autoSend ${BINDIR}/mkList.awk ${BINDIR}/doList.awk

${BINDIR}/autoSend: autoSend
	cp autoSend ${BINDIR}

${BINDIR}/mkList.awk: mkList.awk
	cp mkList.awk ${BINDIR}

${BINDIR}/doList.awk: doList.awk
	cp doList.awk ${BINDIR}

# Administrative stuff...
DELIVERABLES = 	Makefile README SUPPORT TROUBLESHOOTING FEEDBACKWARE Future \
		xbmain.c xbfile.c xbutil.c xbanon.c xbcomm.h xmitBin.1 \
		anonymous.anondat autoSend autoSend.txt doList.awk mkList.awk

ship: ${SHIPDIR}/${TARGET}-${XMITVERS}.tar.Z

${SHIPDIR}/${TARGET}-${XMITVERS}.tar.Z: ${TARGET}-${XMITVERS}.tar.Z
	cp ${TARGET}-${XMITVERS}.tar.Z ${SHIPDIR}

${TARGET}-${XMITVERS}.tar.Z: ${DELIVERABLES}
	rm -f ${TARGET}-${XMITVERS}.tar ${TARGET}-${XMITVERS}.tar.Z
	tar cvf ${TARGET}-${XMITVERS}.tar ${DELIVERABLES}
	compress ${TARGET}-${XMITVERS}.tar


syntax highlighted by Code2HTML, v. 0.9.1