# ********************************************************************
#
# Makefile for egrep-finger, an `extended' finger client and
# server.
# v1.25 -- See file README
#
# Copyright (C) 1998, 1999  Andrew Pitman
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# ********************************************************************
# $Id: Makefile,v 1.25 1999/04/12 05:25:57 ap1 Exp ap1 $
#
#
# Make sure the following is OK for your configuration:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# On most Linux systems, cc is a symlink to gcc.
CC=          cc
#CC=         gcc
#
# CFLAGS:
#CFLAGS=     -Wall
#CFLAGS=     -O2 -Wall
#CFLAGS=     -O2 -fullwarn
#
# LDFLAGS: (This is where the popt library, libpopt.a, is on your system)
LDFLAGS=     /usr/local/lib
#
#
# BSD INSTALL:
INSTALL=     install
#INSTALL=    /usr/bin/install
#
#
# Show home dir, idle time, or login shell as per the docs.
# (Leave these alone!  They are configured out of /etc/efinger/conf)
S_DIR=         -D__SHOW_DIR
S_IDLE=        -D__SHOW_IDLE
S_SHELL=       -D__SHOW_SHELL
#
#
# 24 hour time or not.
# (Obsolete.... configure in /etc/efinger/conf)
#T_FORMAT=      -D__TF_HOUR
#T_FORMAT=
#
#
# Install directories:
INST_DIR=            /usr/local
#INST_DIR=           /usr
BIN_DIR=             ${INST_DIR}/bin
MAN_DIR=             ${INST_DIR}/man
DAEMON_DIR=          /usr/sbin
CONF_DIR=            /etc/efinger
#CONF_DIR=           ${INST_DIR}/etc/efinger
#
#
# Path to in.efingerd:
PATH_EFINGERD=       ${DAEMON_DIR}/in.efingerd
#
#
# Depends on what gethostname() returns on your system
# (safe to leave commented if not sure...  see the docs)
#MAKE_FQDN=          -D__CONSTRUCT_FQDN
#
#
# Allow users to deny access to certain information
# if defined.  Uses ~/.efingerrc
USRCONF=             -D__USER_CONF
#
#
# Use the syslog facility for logging, if defined.
#SYSLOG=             -D__USE_SYSLOG
#SYSLOG=             -D__USE_SYSLOG -D__LOG_LOCAL_QUERIES
#
#
# You shouldn't need to modify anything below this line....
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Header/Source/Object files:
HEADERS=     efinger.h config.h readconf.h remote.h shandlers.h user.h
CFILES=      efinger.c main.c readconf.c remote.c shandlers.c user.c
OBJS=        efinger.o main.o readconf.o remote.o shandlers.o user.o
#
#
# Name of popt library:
LIBS=        -lpopt
#
# Header file locations:
INCS=        -I/usr/include -I.
#
# For debug Purposes.
# (Should be commented in final release)
#DEBUG=      -g -DDEBUG
#DEBUG=
#
#
# rm for clean target:
RM=          /bin/rm
#
#
# Final Target:
# ************
TARG=        efinger
#
#
# For suffix rules:
# (Most versions of make should have these by default, anyway)
.SUFFIXES : .o .c
#
#
# Extra preprocessor definitions:
#
#
# This should be the uid of user nobody on your system
# (or a special user such as "finger" for these purposes).
#
# Defined in config.h
#NOBODY_UID=   -DNOBODY_UID=99
#
#
# Defined if port for `finger' needs to be looked up from
# /etc/services.
#L_PORT=        -D__LOOKUP_PORT
#
#
# Do not honor multiple '@'s in a querystring
# received from a remote host.  Do not comment this
# out unless you know what you are doing!
NO_RELAY=       -D__NO_FINGER_RELAY
#
#
XDEFS=        ${NOBODY_UID} ${S_DIR} ${S_IDLE} ${S_SHELL} ${L_PORT} \
              ${T_FORMAT} ${MAKE_FQDN} ${USRCONF} ${SYSLOG}
#
#
#
# End defines.

all:     ${TARG} in.efingerd

${TARG}: ${OBJS}
	@echo; echo "Making ${TARG} binary"
	@echo "---------------------------"
	${CC} ${DEBUG} ${CFLAGS} ${XDEFS} -o $@ ${OBJS} -L${LDFLAGS} ${LIBS}

.c.o:    ${CFILES} ${HEADERS}
	${CC} ${DEBUG} ${CFLAGS} ${INCS} ${XDEFS} -c $< -o $@

in.efingerd: config.h efingerd.c readconf.c
	@echo; echo "Making all for in.efingerd";
	@echo "---------------------------"
	${CC} ${DEBUG} ${CFLAGS} ${INCS} ${NO_RELAY} -o $@ \
              efingerd.c readconf.c

install: ${TARG} in.efingerd
	@echo; echo "Installing binaries"
	@echo "---------------------------"
	${INSTALL} -o root -g 0 -s -m 755 ${TARG}     ${BIN_DIR}
	${INSTALL} -o root -g 0 -s -m 755 in.efingerd ${DAEMON_DIR}
	@echo; echo "Installing config files"
	@echo "---------------------------"
	${INSTALL} -o root -g 0 -d -m 755 ${CONF_DIR}
	${INSTALL} -o root -g 0    -m 644 conf/conf   ${CONF_DIR}
	${INSTALL} -o root -g 0    -m 644 conf/deny   ${CONF_DIR}
	@echo; echo "Installing manpages"
	@echo "---------------------------"
	${INSTALL} -o root         -m 644 man/efinger.1  ${MAN_DIR}/man1
	${INSTALL} -o root         -m 644 man/in.efingerd.8 ${MAN_DIR}/man8

clean:
	@echo "Now making clean for egrep finger utility...";
	${RM} -f *.o ${TARG} in.efingerd core
	@echo "done."
#
#
# --EOF

