mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-15 02:24:38 +00:00
f6b82ec701
- improves the manual page for both setfiles and restorecon (formatting including alphabetical re-ordering of options, undocumented options, references and a few cosmetic changes); - de-hardcodes a couple of constants in the source files and makes a dynamic use of them to create the manual pages after the compilation and prior to the installation: more specifically the constants are the number of errors for the setfiles' validation process abort condition and the sensitivity of the progress meter for both programs (uses external programs grep and awk); - improves the usage message for both programs and introduces a -h (aliased with currently existing -?) option where not already available; - print out the usage message for restorecon when it is called without arguments; - white-space/tab conversion to get proper indentation towards the end of the main source file. [eparis add .gitignore] Signed-off-by: Guido Trentalancia <guido@trentalancia.com> Signed-off-by: Eric Paris <eparis@redhat.com>
49 lines
1.3 KiB
Makefile
49 lines
1.3 KiB
Makefile
# Installation directories.
|
|
PREFIX ?= $(DESTDIR)/usr
|
|
SBINDIR ?= $(DESTDIR)/sbin
|
|
MANDIR = $(PREFIX)/share/man
|
|
LIBDIR ?= $(PREFIX)/lib
|
|
AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
|
|
|
|
PROGRESS_STEP=$(shell grep "^\#define STAR_COUNT" restore.h | awk -S '{ print $$3 }')
|
|
ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }')
|
|
|
|
CFLAGS = -g -Werror -Wall -W
|
|
override CFLAGS += -I$(PREFIX)/include
|
|
LDLIBS = -lselinux -lsepol -L$(LIBDIR)
|
|
|
|
ifeq ($(AUDITH), /usr/include/libaudit.h)
|
|
override CFLAGS += -DUSE_AUDIT
|
|
LDLIBS += -laudit
|
|
endif
|
|
|
|
all: setfiles restorecon man
|
|
|
|
setfiles: setfiles.o restore.o
|
|
|
|
restorecon: setfiles
|
|
ln -sf setfiles restorecon
|
|
|
|
man:
|
|
@cp -af setfiles.8 setfiles.8.man
|
|
@cp -af restorecon.8 restorecon.8.man
|
|
@sed -i "s/STAR_COUNT/$(PROGRESS_STEP)/g" setfiles.8.man restorecon.8.man
|
|
@sed -i "s/ABORT_ON_ERRORS/$(ABORT_ON_ERRORS)/g" setfiles.8.man
|
|
|
|
install: all
|
|
[ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8
|
|
-mkdir -p $(SBINDIR)
|
|
install -m 755 setfiles $(SBINDIR)
|
|
(cd $(SBINDIR) && ln -sf setfiles restorecon)
|
|
install -m 644 setfiles.8.man $(MANDIR)/man8/setfiles.8
|
|
install -m 644 restorecon.8.man $(MANDIR)/man8/restorecon.8
|
|
|
|
clean:
|
|
rm -f setfiles restorecon *.o setfiles.8.man restorecon.8.man
|
|
|
|
indent:
|
|
../../scripts/Lindent $(wildcard *.[ch])
|
|
|
|
relabel: install
|
|
$(SBINDIR)/restorecon $(SBINDIR)/setfiles
|