From 245b0cbb43e4f7745db1ef6a9082692be6a89053 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Wed, 20 May 2020 21:40:11 -0400 Subject: Rewrite build and install like pounce 1.3 man pages are no longer compressed! --- Makefile | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 96bd125..85eadc2 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,18 @@ -PREFIX = /usr/local -MANDIR = ${PREFIX}/share/man -ETCDIR = ${PREFIX}/etc +PREFIX ?= /usr/local +MANDIR ?= ${PREFIX}/share/man +ETCDIR ?= ${PREFIX}/etc + +CFLAGS += -I${PREFIX}/include +LDFLAGS += -L${PREFIX}/lib CFLAGS += -std=c11 -Wall -Wextra -Wpedantic LDLIBS = -lsqlite3 -LDLIBS.litterbox = -ltls +LDLIBS.litterbox = -lsqlite3 -ltls BINS = litterbox scoop unscoop MANS = ${BINS:=.1} -RCS = +RCS = rc.d/litterbox +INSTALLS = install-rcs -include config.mk @@ -20,10 +24,10 @@ dev: tags all test all: ${BINS} litterbox: ${OBJS.litterbox} - ${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS} ${LDLIBS.$@} -o $@ + ${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@ .o: - ${CC} ${LDFLAGS} $< ${LDLIBS} ${LDLIBS.$@} -o $@ + ${CC} ${LDFLAGS} $< ${LDLIBS} -o $@ ${BINS:=.o}: database.h @@ -33,19 +37,27 @@ test: .test set -e; for format in ${FORMATS}; do ./unscoop -n -f $$format; done touch .test +.SUFFIXES: .in + +.in: + sed -e 's|%%PREFIX%%|${PREFIX}|g' $< > $@ + tags: *.c *.h ctags -w *.c *.h clean: - rm -f .test tags ${BINS} ${OBJS.litterbox} ${BINS:=.o} + rm -f .test tags ${BINS} ${RCS} ${OBJS.litterbox} ${BINS:=.o} + +install: ${BINS} ${MANS} ${INSTALLS} + install -d ${DESTDIR}${PREFIX}/bin ${DESTDIR}${MANDIR}/man1 + install ${BINS} ${DESTDIR}${PREFIX}/bin + install -m 644 ${MANS} ${DESTDIR}${MANDIR}/man1 -install: ${BINS} ${MANS} - install -d ${PREFIX}/bin ${MANDIR}/man1 - install ${BINS} ${PREFIX}/bin - for man in ${MANS}; do gzip -c $$man > ${MANDIR}/man1/$$man.gz; done - if [ -n '${RCS}' ]; then install -d ${ETCDIR}/rc.d; fi - if [ -n '${RCS}' ]; then install ${RCS} ${ETCDIR}/rc.d; fi +install-rcs: ${RCS} + install -d ${DESTDIR}${ETCDIR}/rc.d + install ${RCS} ${DESTDIR}${ETCDIR}/rc.d uninstall: - rm -f ${BINS:%=${PREFIX}/bin/%} ${MANS:%=${MANDIR}/man1/%.gz} - if [ -n '${RCS}' ]; then rm -f ${RCS:%=${ETCDIR}/%}; fi + rm -f ${BINS:%=${DESTDIR}${PREFIX}/bin/%} + rm -f ${MANS:%=${DESTDIR}${MANDIR}/man1/%} + rm -f ${RCS:%=${DESTDIR}${ETCDIR}/%} -- cgit 1.4.1