# $Id: Makefile,v 1.14 2006/01/11 13:09:05 gsson Exp $

PREFIX?=/usr/local
INSTALL_BIN?=${PREFIX}/sbin
INSTALL_MAN?=${PREFIX}/man/man1

INSTALL?=`which install`
GROFF?=`which groff`

# Use these CFLAGS for debugging
#CFLAGS=-g -pedantic -Wall -ansi

CFLAGS+=-pedantic -Wall -ansi

.PHONY: all clean lint

TARGET=expiretable
OBJECTS=expiretable.o ioctl_helpers.o messages.o
MAN=expiretable.1

all: ${TARGET}

install: ${TARGET}
	${INSTALL} -g bin -o root -m 755 ${TARGET} ${INSTALL_BIN}
	${INSTALL} -g bin -o root -m 644 ${MAN} ${INSTALL_MAN}

clean:
	rm -f ${TARGET}
	rm -f ${OBJECTS}
	rm -f llib-lexpiretable.ln
	
obj: ${OBJECTS}

html:
	${GROFF} -Thtml -mandoc expiretable.1 > expiretable.html

lint:
	lint *.c -Cexpiretable -H -I. -I/usr/include

${TARGET}: ${OBJECTS}
	${CC} ${CFLAGS} $> -o $@

.c.o:
	${CC} ${CFLAGS} -c $< -o $@

