2020-08-17 23:20:02 +02:00
|
|
|
UNAME != uname
|
|
|
|
|
2020-08-14 18:21:21 +02:00
|
|
|
PREFIX ?= /usr/local
|
2020-08-17 23:20:02 +02:00
|
|
|
MANDIR ?= ${PREFIX}/man
|
2020-08-14 18:21:21 +02:00
|
|
|
RUNDIR ?= /var/run
|
2020-08-17 23:20:02 +02:00
|
|
|
.if ${UNAME} == OpenBSD
|
|
|
|
ETCDIR ?= /etc
|
|
|
|
.else
|
|
|
|
ETCDIR ?= ${PREFIX}/etc
|
|
|
|
.endif
|
2020-08-14 18:21:21 +02:00
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
CFLAGS += -std=c99 -Wall -Wextra -Wpedantic
|
2020-08-14 18:21:21 +02:00
|
|
|
CFLAGS += -D'ETCDIR="${ETCDIR}"' -D'RUNDIR="${RUNDIR}"'
|
2020-08-14 18:15:03 +02:00
|
|
|
|
2020-08-17 23:20:02 +02:00
|
|
|
RC_SCRIPT = ${UNAME}/catsitd
|
2020-08-15 23:40:08 +02:00
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
-include config.mk
|
|
|
|
|
2020-08-15 22:40:15 +02:00
|
|
|
BINS = catsit catsitd
|
2020-08-14 18:21:21 +02:00
|
|
|
MAN8 = ${BINS:=.8}
|
2020-08-15 22:40:15 +02:00
|
|
|
MAN5 = catsit.conf.5
|
2020-08-14 18:21:21 +02:00
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
OBJS += daemon.o
|
2020-08-14 18:52:51 +02:00
|
|
|
OBJS += service.o
|
2020-08-14 18:15:03 +02:00
|
|
|
|
2020-08-15 15:56:32 +02:00
|
|
|
dev: tags all
|
|
|
|
|
2020-08-14 18:21:21 +02:00
|
|
|
all: ${BINS}
|
2020-08-14 18:15:03 +02:00
|
|
|
|
2020-08-15 22:40:15 +02:00
|
|
|
catsitd: ${OBJS}
|
2020-08-14 18:15:03 +02:00
|
|
|
${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@
|
|
|
|
|
|
|
|
${OBJS}: daemon.h
|
|
|
|
|
2020-08-15 15:56:32 +02:00
|
|
|
tags: *.c *.h
|
|
|
|
ctags -w *.c *.h
|
|
|
|
|
2020-08-15 23:40:08 +02:00
|
|
|
.SUFFIXES: .in
|
|
|
|
|
|
|
|
.in:
|
|
|
|
sed -e 's|%%PREFIX%%|${PREFIX}|g' $< > $@
|
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
clean:
|
2020-08-17 23:20:02 +02:00
|
|
|
rm -f ${BINS} ${OBJS} ${RC_SCRIPT} tags
|
2020-08-14 18:21:21 +02:00
|
|
|
|
2020-08-17 23:20:02 +02:00
|
|
|
install: ${BINS} ${RC_SCRIPT} ${MAN5} ${MAN8}
|
2020-08-15 23:40:08 +02:00
|
|
|
install -d ${DESTDIR}${PREFIX}/sbin ${DESTDIR}${ETCDIR}/rc.d
|
2020-08-14 18:21:21 +02:00
|
|
|
install -d ${DESTDIR}${MANDIR}/man5 ${DESTDIR}${MANDIR}/man8
|
|
|
|
install ${BINS} ${DESTDIR}${PREFIX}/sbin
|
2020-08-17 23:20:02 +02:00
|
|
|
install ${RC_SCRIPT} ${DESTDIR}${ETCDIR}/rc.d
|
2020-08-14 18:21:21 +02:00
|
|
|
install -m 644 ${MAN5} ${DESTDIR}${MANDIR}/man5
|
|
|
|
install -m 644 ${MAN8} ${DESTDIR}${MANDIR}/man8
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f ${BINS:%=${DESTDIR}${PREFIX}/sbin/%}
|
|
|
|
rm -f ${MAN5:%=${DESTDIR}${MANDIR}/man5/%}
|
|
|
|
rm -f ${MAN8:%=${DESTDIR}${MANDIR}/man8/%}
|
2020-08-17 23:20:02 +02:00
|
|
|
rm -f ${DESTDIR}${ETCDIR}/rc.d/${RC_SCRIPT:T}
|