# Makefile for Sentry package.
# 
# Send problems/code hacks to crowland@psionic.com or crowland@bipolar.net
#
#
# STEALTH MODE: I have only tested stealth mode on Linux systems as of
# this version. Although the code *does* compile under BSD (BSDI), I have
# not tested/verified anything. I hope to have this done by version 0.61
#
# Until then, if you are a BSD user (FreeBSD, NetBSD, BSDI, OpenBSD, etc.)
# Please try enabling the -DSUPPORT_STEALTH flag and let me know how it
# works.
#
# The snprintf included with the package is for use with NEXTSTEP only,
# (Thanks Timothy <tjl@luomat.org>) although it may work elsewhere.
# I've not tried it under any other OS to date. It shouldn't be needed
# by any decent modern OS, except of course Solaris. Like I was saying
# though, by any *decent* modern OS. I'll try to get a more compatible
# snprintf() for Solaris in the next release.
#

# Generic compiler
CC = cc
# GNU..
#CC = gcc 

# Normal systems flags
CFLAGS = -O  

# Debug mode for sentry
#CFLAGS = -Wall -g -DDEBUG


INSTALLDIR = /usr/local/abacus


all:
		@echo "Usage: make <systype>"
		@echo "<systype> is one of: linux, bsd, hpux, next, generic"
		@echo "" 
		@echo "Install: make install"
		@echo "" 
		@echo "NOTE: This will install the package in this" 
		@echo "      directory: $(INSTALLDIR)" 
		@echo "" 
		@echo "Edit the makefile if you wish to change these paths." 
		@echo "Any existing files will be overwritten."

clean:		
		/bin/rm ./sentry 

uninstall:	
		/bin/rm $(INSTALLDIR)/sentry*
		/bin/rmdir $(INSTALLDIR)

install:	
		@echo "Creating abacus directory $(INSTALLDIR)"
		@if [ ! -d $(INSTALLDIR) ]; then /bin/mkdir $(INSTALLDIR); fi
		@echo "Setting directory permissions"
		chmod 700 $(INSTALLDIR)
		@echo "Copying files"
		cp ./sentry.conf $(INSTALLDIR)
		cp ./sentry.ignore $(INSTALLDIR)
		cp ./sentry $(INSTALLDIR)
		@echo "Setting permissions"
		chmod 600 $(INSTALLDIR)/sentry.ignore
		chmod 600 $(INSTALLDIR)/sentry.conf
		chmod 700 $(INSTALLDIR)/sentry
		@echo ""
		@echo ""
		@echo "Edit $(INSTALLDIR)/sentry.conf and change"
		@echo "your settings if you haven't already. (route, etc)" 
		@echo ""
		@echo ""

linux:		
		SYSTYPE=linux 
		@echo "Making $(SYSTYPE)"
		$(CC) $(CFLAGS) -DLINUX -DSUPPORT_STEALTH -o ./sentry ./sentry.c ./sentry_io.c

bsd:		
		SYSTYPE=bsd
		@echo "Making $(SYSTYPE)"
		$(CC) $(CFLAGS) -DBSD44 -DSUPPORT_STEALTH -o ./sentry ./sentry.c ./sentry_io.c

generic:		
		SYSTYPE=generic
		@echo "Making $(SYSTYPE)"
		$(CC) $(CFLAGS) -o ./sentry ./sentry.c ./sentry_io.c

# Below are not well tested
next:		
		SYSTYPE=next
		@echo "Making $(SYSTYPE)"
		$(CC) $(CFLAGS) -DNEXT -DHAS_NO_SNPRINTF -posix -o ./sentry ./sentry.c ./sentry_io.c

hpux:		
		SYSTYPE=hpux
		@echo "Making $(SYSTYPE)"
		$(CC) $(HPUX_CFLAGS) -Ae -DHPUX -o ./sentry ./sentry.c ./sentry_io.c

