# Please NOTE:  None of the TACACS code available here comes with any
# warranty or support.
# Copyright (c) 1995 by Cisco systems, Inc.
# All rights reserved.

VERSION = 2.1

# CC = gcc

# For AIX
# CC=bsdcc
# OS=-DAIX

# For HP/UX uncomment the following line
# OS=-DHPUX

# For MIPS, uncomment the following line
# OS=-DMIPS

# For Solaris (SUNOS 5.3, 5.4) uncomment the following two lines
# OS=-DSOLARIS
# OSLIBS=-lsocket -lnsl

# For FreeBSD
# OS=-DFREEBSD
# You may also need to add
# OSLIBS=-lcrypt

# For LINUX
# OS=-DLINUX

# Athough invoked as root, most of the time you don't want tac_plus to
# be running as root. If USERID and GROUPID are set, tac_plus will
# attempt change to run as that user & group after reading the
# configuration file and obtaining a privileged socket. If you always
# want tac_plus to run as root, then just comment out the FLAGS line.

# USERID  = 1500
# GROUPID = 25
# FLAGS   = -DTAC_PLUS_USERID=$(USERID) -DTAC_PLUS_GROUPID=$(GROUPID)

# Definitions for SKEY functionality
# DEFINES = -DSKEY
# LIBS = ../crimelab/skey/src/libskey.a
# INCLUDES = -I../crimelab/skey/src

DEBUG = -g

# On startup, tac_plus creates the file /etc/tac_plus.pid (if
# possible), containing its process id. Uncomment and modify the
# following line to change this filename

# PIDFILE = -DTAC_PLUS_PIDFILE=\"/var/run/tac_plus.pid\" 

#
# End of customisable section of Makefile
#

CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(FLAGS) $(OS) $(PIDFILE)

SRCS =	acct.c authen.c author.c choose_authen.c config.c do_acct.c \
	do_author.c dump.c encrypt.c expire.c md5.c \
	packet.c report.c sndpass.c tac_plus.c utils.c pw.c hash.c \
	parse.c regexp.c programs.c enable.c pwlib.c default_fn.c \
	skey_fn.c

OBJS = $(SRCS:.c=.o)

all:
	@echo "Please edit the Makefile and then make tac_plus"

tac_plus: $(OBJS) $(LIBS) generate_passwd
	$(CC) -o tac_plus $(CFLAGS) $(OBJS) $(LIBS) $(OSLIBS)

purecov: $(OBJS) $(LIBS)
	purecov -follow-child-processes -handle-signals=SIGTERM \
	    $(CC) -o tac_plus $(CFLAGS) $(OBJS) $(LIBS) $(OSLIBS)

purify: $(OBJS) $(LIBS)
	purify $(CC) -o tac_plus $(CFLAGS) $(OBJS) $(LIBS) $(OSLIBS)

generate_passwd:
	$(CC) $(CFLAGS) -o generate_passwd generate_passwd.c $(OSLIBS)

saber:
	#load $(CFLAGS) $(SRCS) $(LIBS)

clean:
	-rm -f *.o *~ *.BAK tac_plus generate_passwd

tar:
	-rm -rf tac_plus.$(VERSION)
	-mkdir tac_plus.$(VERSION)
	-mkdir tac_plus.$(VERSION)/bin
	cp CHANGES $(SRCS) expire.h parse.h regmagic.h md5.h regexp.h tac_plus.h convert.pl generate_passwd.c tac_plus.1 users_guide Makefile tac_plus.$(VERSION)
	cp bin/tac_plus* tac_plus.$(VERSION)/bin
	tar -cvf - ./tac_plus.$(VERSION) > tac_plus.$(VERSION).tar

install:
	cp tac_plus /usr/local/bin
	cp tac_plus.1 /usr/man/manl/tac_plus.l

depend:
	makedepend $(CFLAGS) $(SRCS)

# DO NOT DELETE THIS LINE -- make depend depends on it.

