From ac6f3e018f3261fd14bd9062d80e79d6e1e5966e Mon Sep 17 00:00:00 2001 Date: Fri, 27 Oct 2017 21:05:12 +0300 Subject: [PATCH] Change install dir --- Makefile | 70 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 4b60744..c0c8566 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,21 @@ LOADLIBES := -llockfile CFLAGS := -g -Wall -Wformat-security -Werror -O2 +BINDIR := usr/bin +MANDIR := usr/share/man/man1 all: lockfile-create - rm -rf bin - mkdir -p bin - cp -a lockfile-create bin - cp -a lockfile-create bin/mail-lock - cd bin && ln lockfile-create lockfile-remove - cd bin && ln lockfile-create lockfile-touch - cd bin && ln lockfile-create lockfile-check - cd bin && ln mail-lock mail-unlock - cd bin && ln mail-lock mail-touchlock - mkdir -p man - cp -a lockfile-progs.1 man - (cd man && ln -sf lockfile-progs.1 lockfile-create.1 && \ + mkdir -p $(DESTDIR)/$(BINDIR) + cp -a lockfile-create $(DESTDIR)/$(BINDIR) + cp -a lockfile-create $(DESTDIR)/$(BINDIR)/mail-lock + cd $(DESTDIR)/$(BINDIR) && ln lockfile-create lockfile-remove + cd $(DESTDIR)/$(BINDIR) && ln lockfile-create lockfile-touch + cd $(DESTDIR)/$(BINDIR) && ln lockfile-create lockfile-check + cd $(DESTDIR)/$(BINDIR) && ln mail-lock mail-unlock + cd $(DESTDIR)/$(BINDIR) && ln mail-lock mail-touchlock + mkdir -p $(DESTDIR)/$(MANDIR) + cp -a lockfile-progs.1 $(DESTDIR)/$(MANDIR) + (cd $(DESTDIR)/$(MANDIR) && ln -sf lockfile-progs.1 lockfile-create.1 && \ ln -sf lockfile-progs.1 lockfile-remove.1 && \ ln -sf lockfile-progs.1 lockfile-touch.1 && \ ln -sf lockfile-progs.1 lockfile-check.1 && \ @@ -26,31 +27,32 @@ all: lockfile-create lockfile-create: lockfile-progs.o ${CC} -o $@ ${LDFLAGS} $^ ${LOADLIBES} +install: all + # These tests are quite insufficient, but perhaps better than nothing for now. check: all - rm -rf check - mkdir check - - bin/lockfile-create check/file - bin/lockfile-touch --oneshot check/file - bin/lockfile-check check/file - bin/lockfile-remove check/file - ! test -e check/file.lock - - bin/lockfile-create --lock-name check/file.lock - bin/lockfile-touch --oneshot --lock-name check/file.lock - bin/lockfile-check --lock-name check/file.lock - bin/lockfile-remove --lock-name check/file.lock - ! test -e check/file.lock - - bin/lockfile-create --use-pid --lock-name check/file.lock - bin/lockfile-touch --oneshot --lock-name check/file.lock + mkdir $(DESTDIR)/usr/check + + $(DESTDIR)/$(BINDIR)/lockfile-create $(DESTDIR)/usr/check/file + $(DESTDIR)/$(BINDIR)/lockfile-touch --oneshot $(DESTDIR)/usr/check/file + $(DESTDIR)/$(BINDIR)/lockfile-check $(DESTDIR)/usr/check/file + $(DESTDIR)/$(BINDIR)/lockfile-remove $(DESTDIR)/usr/check/file + ! test -e $(DESTDIR)/usr/check/file.lock + + $(DESTDIR)/$(BINDIR)/lockfile-create --lock-name $(DESTDIR)/usr/check/file.lock + $(DESTDIR)/$(BINDIR)/lockfile-touch --oneshot --lock-name $(DESTDIR)/usr/check/file.lock + $(DESTDIR)/$(BINDIR)/lockfile-check --lock-name $(DESTDIR)/usr/check/file.lock + $(DESTDIR)/$(BINDIR)/lockfile-remove --lock-name $(DESTDIR)/usr/check/file.lock + ! test -e $(DESTDIR)/usr/check/file.lock + + $(DESTDIR)/$(BINDIR)/lockfile-create --use-pid --lock-name $(DESTDIR)/usr/check/file.lock + $(DESTDIR)/$(BINDIR)/lockfile-touch --oneshot --lock-name $(DESTDIR)/usr/check/file.lock # PID shouldn't be the same, so this should fail. - bin/lockfile-check --use-pid --lock-name check/file.lock - bin/lockfile-remove --lock-name check/file.lock - ! test -e check/file.lock + $(DESTDIR)/$(BINDIR)/lockfile-check --use-pid --lock-name $(DESTDIR)/usr/check/file.lock + $(DESTDIR)/$(BINDIR)/lockfile-remove --lock-name $(DESTDIR)/usr/check/file.lock + ! test -e $(DESTDIR)/usr/check/file.lock - bin/lockfile-create --use-pid --lock-name check/lockfile.no-pid + $(DESTDIR)/$(BINDIR)/lockfile-create --use-pid --lock-name $(DESTDIR)/usr/check/lockfile.no-pid .PHONY: check distclean: clean @@ -58,6 +60,4 @@ clean: rm -f lockfile-create lockfile-remove lockfile-touch lockfile-check rm -f mail-lock mail-unlock mail-touchlock rm -f *.o *~ - rm -rf bin man - rm -rf check .PHONY: clean distclean -- 2.16.4