catsit/Makefile

80 lines
1.7 KiB
Makefile
Raw Normal View History

UNAME != uname
2020-08-14 18:21:21 +02:00
PREFIX ?= /usr/local
MANDIR ?= ${PREFIX}/man
2020-08-14 18:21:21 +02:00
RUNDIR ?= /var/run
.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
RC_SCRIPT = ${UNAME}/catsitd
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
MAN1 = ${BINS:=.1}
2020-08-15 22:40:15 +02:00
MAN5 = catsit.conf.5
2021-02-25 21:42:24 +01:00
MAN8 = ${SBINS:=.8}
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
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}
2020-08-14 18:15:03 +02:00
${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@
${OBJS}: daemon.h
.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-14 18:15:03 +02:00
clean:
2021-02-25 21:42:24 +01:00
rm -f ${BINS} ${SBINS} ${OBJS} ${RC_SCRIPT} tags
install: ${BINS} ${SBINS} ${RC_SCRIPT} ${MAN1} ${MAN5} ${MAN8}
install -d ${DESTDIR}${PREFIX}/bin
install -d ${DESTDIR}${PREFIX}/sbin
install -d ${DESTDIR}${MANDIR}/man1
install -d ${DESTDIR}${MANDIR}/man5
install -d ${DESTDIR}${MANDIR}/man8
install -d ${DESTDIR}${ETCDIR}/rc.d
install ${BINS} ${DESTDIR}${PREFIX}/bin
install ${SBINS} ${DESTDIR}${PREFIX}/sbin
install ${RC_SCRIPT} ${DESTDIR}${ETCDIR}/rc.d
2021-02-25 21:42:24 +01:00
install -m 644 ${MAN1} ${DESTDIR}${MANDIR}/man1
2020-08-14 18:21:21 +02:00
install -m 644 ${MAN5} ${DESTDIR}${MANDIR}/man5
install -m 644 ${MAN8} ${DESTDIR}${MANDIR}/man8
uninstall:
2021-02-25 21:42:24 +01:00
.for BIN in ${BINS}
rm -f ${DESTDIR}${PREFIX}/bin/${BIN}
.endfor
.for SBIN in ${SBINS}
rm -f ${DESTDIR}${PREFIX}/sbin/${SBIN}
.endfor
rm -f ${DESTDIR}${ETCDIR}/rc.d/${RC_SCRIPT:T}
2021-02-25 21:42:24 +01:00
.for MAN in ${MAN1}
rm -f ${DESTDIR}${MANDIR}/man1/${MAN}
.endfor
.for MAN in ${MAN5}
rm -f ${DESTDIR}${MANDIR}/man5/${MAN}
.endfor
.for MAN in ${MAN8}
rm -f ${DESTDIR}${MANDIR}/man8/${MAN}
.endfor