#
# Makefile for building webportfwd
#

# Modify Install Prefix to where you want this installed
INSTALL_PREFIX="/usr/local"

# Choos the platform you are building on

# Linux - uncomment next two lines for building under linux
LIBS=

# Solaris - uncomment next two lines for building under solaris
#LIBS=-lgen -lsocket

# --------------- No Modifications Needed Below This Line ------------------
PROG=webportfwd
SRC=${PROG:%=%.c}

all: ${PROG}

install: all
	@if [ ! -d ${INSTALL_PREFIX}/bin ] ; then \
		mkdir -p ${INSTALL_PREFIX}/bin; \
		mkdir -p ${INSTALL_PREFIX}/man/man1; \
		mkdir -p ${INSTALL_PREFIX}/etc; \
	fi;
	cp ${PROG} ${INSTALL_PREFIX}/bin
	cp ${PROG}.conf ${INSTALL_PREFIX}/etc
	cp ${PROG}.man ${INSTALL_PREFIX}/man/man1/${PROG}.1

clean:
	@rm -f ${PROG}

${PROG}: ${SRC}
	cc -DINSTALL_PREFIX=\"${INSTALL_PREFIX}\" ${SRC} -o $@ ${LIBS}

uninstall:
	@echo "uninstalling ${PROG}"
	@rm -f ${INSTALL_PREFIX}/bin/${PROG}
	@echo "deleting configuration ${PROG}.conf"
	@rm -f ${INSTALL_PREFIX}/etc/${PROG}.conf
	@echo "deleting man pages for ${PROG}"
	@rm -f ${INSTALL_PREFIX}/man/man1/${PROG}.1
