2008-08-19 19:30:36 +00:00
|
|
|
# Installation directories.
|
2011-09-19 20:38:33 +00:00
|
|
|
PREFIX ?= $(DESTDIR)/usr
|
2008-08-19 19:30:36 +00:00
|
|
|
SBINDIR ?= $(DESTDIR)/sbin
|
|
|
|
MANDIR = $(PREFIX)/share/man
|
|
|
|
LIBDIR ?= $(PREFIX)/lib
|
2017-04-24 17:59:59 +00:00
|
|
|
AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
|
2008-08-19 19:30:36 +00:00
|
|
|
|
2012-08-22 07:13:43 +00:00
|
|
|
ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }')
|
|
|
|
|
2013-05-10 12:45:11 +00:00
|
|
|
CFLAGS ?= -g -Werror -Wall -W
|
2017-04-24 17:59:56 +00:00
|
|
|
LDLIBS = -lselinux -lsepol
|
2008-08-19 19:30:36 +00:00
|
|
|
|
2017-04-24 17:59:59 +00:00
|
|
|
ifeq ($(AUDITH), y)
|
2008-08-19 19:30:36 +00:00
|
|
|
override CFLAGS += -DUSE_AUDIT
|
|
|
|
LDLIBS += -laudit
|
|
|
|
endif
|
|
|
|
|
2016-09-26 15:30:30 +00:00
|
|
|
all: setfiles restorecon restorecon_xattr man
|
2008-08-19 19:30:36 +00:00
|
|
|
|
2009-09-10 18:54:35 +00:00
|
|
|
setfiles: setfiles.o restore.o
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
restorecon: setfiles
|
|
|
|
ln -sf setfiles restorecon
|
|
|
|
|
2016-09-26 15:30:30 +00:00
|
|
|
restorecon_xattr: restorecon_xattr.o restore.o
|
|
|
|
|
2012-08-22 07:13:43 +00:00
|
|
|
man:
|
|
|
|
@cp -af setfiles.8 setfiles.8.man
|
|
|
|
@sed -i "s/ABORT_ON_ERRORS/$(ABORT_ON_ERRORS)/g" setfiles.8.man
|
|
|
|
|
2008-08-19 19:30:36 +00:00
|
|
|
install: all
|
|
|
|
[ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8
|
|
|
|
-mkdir -p $(SBINDIR)
|
|
|
|
install -m 755 setfiles $(SBINDIR)
|
|
|
|
(cd $(SBINDIR) && ln -sf setfiles restorecon)
|
2016-09-26 15:30:30 +00:00
|
|
|
install -m 755 restorecon_xattr $(SBINDIR)
|
2012-08-22 07:13:43 +00:00
|
|
|
install -m 644 setfiles.8.man $(MANDIR)/man8/setfiles.8
|
2017-01-27 12:47:49 +00:00
|
|
|
install -m 644 restorecon.8 $(MANDIR)/man8/restorecon.8
|
2016-09-26 15:30:30 +00:00
|
|
|
install -m 644 restorecon_xattr.8 $(MANDIR)/man8/restorecon_xattr.8
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
clean:
|
2017-01-27 12:47:49 +00:00
|
|
|
rm -f setfiles restorecon restorecon_xattr *.o setfiles.8.man
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
indent:
|
|
|
|
../../scripts/Lindent $(wildcard *.[ch])
|
|
|
|
|
|
|
|
relabel: install
|
2016-09-26 15:30:30 +00:00
|
|
|
$(SBINDIR)/restorecon $(SBINDIR)/setfiles $(SBINDIR)/restorecon_xattr
|