From bf3520374f51f9b62d7f2942d0f484913eaaa763 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Sun, 1 May 2016 03:25:59 +0200 Subject: [PATCH] Allow installing the binaries under /usr/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch reworks the directory-related variables to allow installation of binaries under `/usr/[s]bin`, instead of directly under `/[s]bin`. It also allows installing the man pages under a different prefix (e.g. `/usr/local`). Example: $ make install EXEC_PREFIX=/usr will install binaries under `/usr/bin`, respectively `/usr/sbin`. A full "local" installation under `/usr/local` is accomplished by: $ make install EXEC_PREFIX=/usr/local PREFIX=/usr/local This patch points once again that an autoconf/automake conversion would make a lot of sense… Closes #3. Additionally, it fixes a previous bug with installation of the manual pages. --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index c0a11cd..eb3744e 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ CFLAGS?= -Wall -O2 -SBINDIR= $(DESTDIR)/sbin -BINDIR= $(DESTDIR)/bin -USRBINDIR= $(DESTDIR)/usr/bin -MANDIR= $(DESTDIR)/usr/share/man +PREFIX?= /usr +EXEC_PREFIX?= / +SBINDIR= $(DESTDIR)/$(EXEC_PREFIX)/sbin +BINDIR= $(DESTDIR)$(EXEC_PREFIX)/bin +DATAROOTDIR= $(DESTDIR)/$(PREFIX)/share +MANDIR= $(DATAROOTDIR)/man DEFTAPE?= /dev/tape -MTDIR=$(BINDIR) - PROGS=mt stinit @@ -36,8 +36,8 @@ version.h: Makefile $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DDEFTAPE='"$(DEFTAPE)"' -o $@ $< install: $(PROGS) - install -d $(MTDIR) $(MANDIR) $(SBINDIR) - install -s mt $(MTDIR) + install -d $(BINDIR) $(SBINDIR) $(MANDIR) $(MANDIR)/man1 $(MANDIR)/man8 + install -s mt $(BINDIR) install -c -m 444 mt.1 $(MANDIR)/man1 (if [ -f $(MANDIR)/man1/mt.1.gz ] ; then \ rm -f $(MANDIR)/man1/mt.1.gz; gzip $(MANDIR)/man1/mt.1; fi)