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
|
|
|
ETCDIR ?= ${PREFIX}/etc
|
2020-08-14 18:21:21 +02:00
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
CFLAGS += -std=c99 -Wall -Wextra -Wpedantic
|
2022-04-21 20:26:49 +02:00
|
|
|
CFLAGS += -D'ETCDIR="${ETCDIR}"' -D'RUNDIR="${RUNDIR}"' -I'/usr/local/include/kqueue' -I'/usr/local/include' -D'_POSIX_C_SOURCE=199309L' -u,libbsd_init_func -lbsd-ctor -lbsd -lkqueue
|
2020-08-14 18:15:03 +02:00
|
|
|
|
2022-04-21 20:26:49 +02:00
|
|
|
RC_SCRIPT = rc.catsit
|
2020-08-15 23:40:08 +02:00
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
-include config.mk
|
|
|
|
|
2021-02-26 01:45:56 +01:00
|
|
|
BINS = catsit-timer catsit-watch
|
2021-02-25 21:42:24 +01:00
|
|
|
SBINS = catsit catsitd
|
2022-02-26 06:33:32 +01:00
|
|
|
MANS = ${BINS:=.1} catsit.conf.5 ${SBINS:=.8}
|
2020-08-14 18:21:21 +02:00
|
|
|
|
2022-02-26 06:33:32 +01:00
|
|
|
OBJS = daemon.o service.o
|
2020-08-14 18:15:03 +02:00
|
|
|
|
2020-08-15 15:56:32 +02:00
|
|
|
dev: tags all
|
|
|
|
|
2021-02-25 21:42:24 +01:00
|
|
|
all: ${BINS} ${SBINS}
|
2020-08-14 18:15:03 +02:00
|
|
|
|
2020-08-15 22:40:15 +02:00
|
|
|
catsitd: ${OBJS}
|
2022-04-21 20:26:49 +02:00
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@
|
2020-08-14 18:15:03 +02:00
|
|
|
|
|
|
|
${OBJS}: daemon.h
|
|
|
|
|
2020-08-15 23:40:08 +02:00
|
|
|
.SUFFIXES: .in
|
|
|
|
|
|
|
|
.in:
|
2020-08-18 05:25:34 +02:00
|
|
|
sed -e 's|%%PREFIX%%|${PREFIX}|g' -e 's|%%RUNDIR%%|${RUNDIR}|g' $< > $@
|
2020-10-23 17:10:00 +02:00
|
|
|
chmod a+x $@
|
2020-08-18 05:25:34 +02:00
|
|
|
|
2021-02-25 21:42:24 +01:00
|
|
|
tags: *.[ch]
|
|
|
|
ctags -w *.[ch]
|
2020-08-15 23:40:08 +02:00
|
|
|
|
2020-08-14 18:15:03 +02:00
|
|
|
clean:
|
2021-02-25 21:42:24 +01:00
|
|
|
rm -f ${BINS} ${SBINS} ${OBJS} ${RC_SCRIPT} tags
|
|
|
|
|
2022-04-21 20:26:49 +02:00
|
|
|
install: ${BINS} ${SBINS} ${MANS}
|
2021-02-25 21:42:24 +01:00
|
|
|
install -d ${DESTDIR}${PREFIX}/bin
|
|
|
|
install -d ${DESTDIR}${PREFIX}/sbin
|
|
|
|
install -d ${DESTDIR}${ETCDIR}/rc.d
|
|
|
|
install ${BINS} ${DESTDIR}${PREFIX}/bin
|
|
|
|
install ${SBINS} ${DESTDIR}${PREFIX}/sbin
|
2022-04-21 20:26:49 +02:00
|
|
|
for section in 1 5 8; do install -d ${DESTDIR}${MANDIR}/man$$section; done
|
|
|
|
for manpage in ${MANS}; do install -m 444 $$manpage ${DESTDIR}${MANDIR}/man"$${manpage##*.}"; done
|
2020-08-17 23:20:02 +02:00
|
|
|
install ${RC_SCRIPT} ${DESTDIR}${ETCDIR}/rc.d
|
2020-08-14 18:21:21 +02:00
|
|
|
|
|
|
|
uninstall:
|
2022-04-21 20:26:49 +02:00
|
|
|
for bin in ${BINS}; \
|
|
|
|
do \
|
|
|
|
rm ${DESTDIR}${PREFIX}/bin/$$bin ; \
|
|
|
|
done ; \
|
|
|
|
for sbin in ${SBINS} ; \
|
|
|
|
do \
|
|
|
|
rm ${DESTDIR}${PREFIX}/sbin/$$sbin ; \
|
|
|
|
done ; \
|
|
|
|
for man in ${MANS} ; \
|
|
|
|
do \
|
|
|
|
rm ${DESTDIR}${MANDIR}/man*/$$man ; \
|
|
|
|
done ; \
|
|
|
|
rm ${DESTDIR}${ETCDIR}/rc.d/${RC_SCRIPT}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|