Allow installing the binaries under /usr/

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.
This commit is contained in:
Iustin Pop
2016-05-01 03:25:59 +02:00
parent 75644f8ccd
commit bf3520374f

View File

@@ -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)