Skip to contentSkip to conversation

Fix BINDIR/SBINDIR/... variables in Makefiles

PATCH New Stephen Smalley 1 participant 1 message Jun 20, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 needed (load_policy was moved in 2009).

---
 checkpolicy/test/Makefile            | 2 +-
 libselinux/utils/Makefile            | 6 +++---
 mcstrans/utils/Makefile              | 6 +++---
 policycoreutils/hll/pp/Makefile      | 1 -
 policycoreutils/load_policy/Makefile | 3 ---
 policycoreutils/scripts/Makefile     | 4 +---
 python/chcat/Makefile                | 2 --
 python/sepolicy/Makefile             | 1 -
 8 files changed, 8 insertions(+), 17 deletions(-)
checkpolicy/test/Makefile +1 -1
index 0a31c5e..59fa446 100644
@@ -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
libselinux/utils/Makefile +3 -3
index 474ee95..843b0e7 100644
@@ -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 *~
mcstrans/utils/Makefile +3 -3
index 7e59641..83ac343 100644
@@ -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
policycoreutils/hll/pp/Makefile +0 -1
index 813c9c6..9dc2dc5 100644
@@ -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
policycoreutils/load_policy/Makefile +0 -3
index 256d95a..0db030b 100644
@@ -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 
policycoreutils/scripts/Makefile +1 -3
index 969e5c0..d9e86ff 100644
@@ -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/
python/chcat/Makefile +0 -2
index 0a52e8f..0fd12d6 100644
@@ -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
 
python/sepolicy/Makefile +0 -1
index 647c540..0d2bec2 100644
@@ -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
Signature · 1 line
2.9.4