# This is the Makefile of watchdog
#
# If you don't want to log any activity uncomment the following
#
SYSLOG = -DUSE_SYSLOG
#
# What's the name of your softdog device?
#
DEV = -DDEVNAME=\"/dev/watchdog\"
#
# name of the PID file
#
PID = -DPIDFILE=\"/var/run/watchdog.pid\"
#
# kernel timer margin 
#
TM = -DTIMER_MARGIN=60  
#
# Were do you want to install watchdog?
#
DESTDIR=
SBINDIR=$(DESTDIR)/usr/sbin
MANDIR=${DESTDIR}/usr/man/man8
#
# You shouldn't have to change anything below here
#
CC=gcc
CFLAGS=-g -O2
CPPFLAGS=${SYSLOG} ${DEV} ${PID} ${TM}
#
MAJOR_VERSION = 1
MINOR_VERSION = 2

all: version.h watchdog.c
	$(CC) $(CFLAGS) ${CPPFLAGS} -Wall watchdog.c -o watchdog

version.h: Makefile
	@echo "/* actual version */" > version.h
	@echo "#define MAJOR_VERSION ${MAJOR_VERSION}" >> version.h
	@echo "#define MINOR_VERSION ${MINOR_VERSION}" >> version.h

install: all
	install -d $(SBINDIR)
	install -g root -o root -m 700 -s watchdog $(SBINDIR)
	install -d $(MANDIR)
	install -g root -o root -m 644 watchdog.8 $(MANDIR)

clean:
	rm watchdog version.h
