diff options
-rw-r--r-- | Makefile | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile index a37a40f..6454448 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,18 @@ +UNAME != uname + PREFIX ?= /usr/local -MANDIR ?= ${PREFIX}/share/man -ETCDIR ?= ${PREFIX}/etc +MANDIR ?= ${PREFIX}/man RUNDIR ?= /var/run +.if ${UNAME} == OpenBSD +ETCDIR ?= /etc +.else +ETCDIR ?= ${PREFIX}/etc +.endif CFLAGS += -std=c99 -Wall -Wextra -Wpedantic CFLAGS += -D'ETCDIR="${ETCDIR}"' -D'RUNDIR="${RUNDIR}"' -RC = FreeBSD/catsitd +RC_SCRIPT = ${UNAME}/catsitd -include config.mk @@ -35,13 +41,13 @@ tags: *.c *.h sed -e 's|%%PREFIX%%|${PREFIX}|g' $< > $@ clean: - rm -f ${BINS} ${OBJS} ${RC} tags + rm -f ${BINS} ${OBJS} ${RC_SCRIPT} tags -install: ${BINS} ${RC} ${MAN5} ${MAN8} +install: ${BINS} ${RC_SCRIPT} ${MAN5} ${MAN8} install -d ${DESTDIR}${PREFIX}/sbin ${DESTDIR}${ETCDIR}/rc.d install -d ${DESTDIR}${MANDIR}/man5 ${DESTDIR}${MANDIR}/man8 install ${BINS} ${DESTDIR}${PREFIX}/sbin - install ${RC} ${DESTDIR}${ETCDIR}/rc.d + install ${RC_SCRIPT} ${DESTDIR}${ETCDIR}/rc.d install -m 644 ${MAN5} ${DESTDIR}${MANDIR}/man5 install -m 644 ${MAN8} ${DESTDIR}${MANDIR}/man8 @@ -49,4 +55,4 @@ uninstall: rm -f ${BINS:%=${DESTDIR}${PREFIX}/sbin/%} rm -f ${MAN5:%=${DESTDIR}${MANDIR}/man5/%} rm -f ${MAN8:%=${DESTDIR}${MANDIR}/man8/%} - rm -f ${DESTDIR}${ETCDIR}/rc.d/catsitd + rm -f ${DESTDIR}${ETCDIR}/rc.d/${RC_SCRIPT:T} |