Fix BINDIR/SBINDIR/... variables in Makefiles

As reported by Nicolas Iooss, there are still some inconsistencies
in the definitions and usage of Makefile variables related to bin
and sbin directories. Since we need to still support non-usrmerge
systems, we cannot completely synchronize them, but we can eliminate
unnecessary differences, remove unused variables, and drop the
USRSBINDIR variables.

Before:
$ find . -name Makefile -exec cat {} + |grep '^[A-Z_]*BINDIR' |sort -u
BINDIR=$(PREFIX)/bin
BINDIR ?= $(PREFIX)/bin
BINDIR ?= $(PREFIX)/sbin
SBINDIR ?= $(DESTDIR)/sbin
SBINDIR ?= $(PREFIX)/sbin
USRSBINDIR ?= $(PREFIX)/sbin

After:
$ find . -name Makefile -exec cat {} + | grep '^[A-Z_]*BINDIR' | sort -u
BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(DESTDIR)/sbin
SBINDIR ?= $(PREFIX)/sbin

This does not change the actual install location of any file.
It does drop the legacy symlink from /usr/sbin/load_policy to
/sbin/load_policy; packagers can create that separately if
desired.

Reported-by: Nicolas Iooss <nicolas.iooss@m4x.org>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
Stephen Smalley 2017-06-20 10:49:57 -04:00
parent 15f2740733
commit 7b5699bfd7
8 changed files with 8 additions and 17 deletions

View File

@ -2,7 +2,7 @@
# Makefile for building the dispol program
#
PREFIX ?= $(DESTDIR)/usr
BINDIR=$(PREFIX)/bin
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
INCLUDEDIR ?= $(PREFIX)/include
LIBSEPOLA ?= $(LIBDIR)/libsepol.a

View File

@ -1,7 +1,7 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
LIBDIR ?= $(PREFIX)/lib
USRSBINDIR ?= $(PREFIX)/sbin
SBINDIR ?= $(PREFIX)/sbin
INCLUDEDIR ?= $(PREFIX)/include
OS ?= $(shell uname)
@ -63,8 +63,8 @@ sefcontext_compile: sefcontext_compile.o ../src/regex.o
all: $(TARGETS)
install: all
-mkdir -p $(USRSBINDIR)
install -m 755 $(TARGETS) $(USRSBINDIR)
-mkdir -p $(SBINDIR)
install -m 755 $(TARGETS) $(SBINDIR)
clean:
rm -f $(TARGETS) *.o *~

View File

@ -1,7 +1,7 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
LIBDIR ?= $(PREFIX)/lib
BINDIR ?= $(PREFIX)/sbin
SBINDIR ?= $(PREFIX)/sbin
LIBSEPOLA ?= $(LIBDIR)/libsepol.a
CFLAGS ?= -Wall
@ -15,8 +15,8 @@ all: $(TARGETS)
$(TARGETS): ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA)
install: all
-mkdir -p $(BINDIR)
install -m 755 $(TARGETS) $(BINDIR)
-mkdir -p $(SBINDIR)
install -m 755 $(TARGETS) $(SBINDIR)
test:
./mlstrans-test-runner.py ../test/*.test

View File

@ -1,7 +1,6 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
INCLUDEDIR ?= $(PREFIX)/include
SBINDIR ?= $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
LIBDIR ?= $(PREFIX)/lib
LIBEXECDIR ?= $(PREFIX)/libexec

View File

@ -1,7 +1,6 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
SBINDIR ?= $(DESTDIR)/sbin
USRSBINDIR ?= $(PREFIX)/sbin
MANDIR ?= $(PREFIX)/share/man
LOCALEDIR ?= /usr/share/locale
@ -18,8 +17,6 @@ install: all
install -m 755 $(TARGETS) $(SBINDIR)
test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8
install -m 644 load_policy.8 $(MANDIR)/man8/
-mkdir -p $(USRSBINDIR)
-ln -sf $(SBINDIR)/load_policy $(USRSBINDIR)/load_policy
clean:
-rm -f $(TARGETS) *.o

View File

@ -1,7 +1,5 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
BINDIR ?= $(PREFIX)/bin
USRSBINDIR ?= $(PREFIX)/sbin
SBINDIR ?= $(DESTDIR)/sbin
MANDIR ?= $(PREFIX)/share/man
LOCALEDIR ?= $(PREFIX)/share/locale
@ -10,7 +8,7 @@ LOCALEDIR ?= $(PREFIX)/share/locale
all: fixfiles
install: all
-mkdir -p $(BINDIR)
-mkdir -p $(SBINDIR)
install -m 755 fixfiles $(SBINDIR)
-mkdir -p $(MANDIR)/man8
install -m 644 fixfiles.8 $(MANDIR)/man8/

View File

@ -1,8 +1,6 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
BINDIR ?= $(PREFIX)/bin
USRSBINDIR ?= $(PREFIX)/sbin
SBINDIR ?= $(DESTDIR)/sbin
MANDIR ?= $(PREFIX)/share/man
LOCALEDIR ?= $(PREFIX)/share/locale

View File

@ -5,7 +5,6 @@ PREFIX ?= $(DESTDIR)/usr
SYSCONFDIR ?= $(DESTDIR)/etc/sysconfig
LIBDIR ?= $(PREFIX)/lib
BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(PREFIX)/share/man
LOCALEDIR ?= /usr/share/locale