2008-08-19 19:30:36 +00:00
|
|
|
# Installation directories.
|
2018-02-14 09:57:09 +00:00
|
|
|
PREFIX ?= /usr
|
|
|
|
SBINDIR ?= /sbin
|
2008-08-19 19:30:36 +00:00
|
|
|
MANDIR = $(PREFIX)/share/man
|
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-06-20 15:16:41 +00:00
|
|
|
override 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
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -laudit
|
2008-08-19 19:30:36 +00:00
|
|
|
endif
|
|
|
|
|
2016-09-26 15:30:30 +00:00
|
|
|
all: setfiles restorecon restorecon_xattr man
|
2008-08-19 19:30:36 +00:00
|
|
|
|
2017-06-20 15:16:41 +00:00
|
|
|
setfiles: setfiles.o restore.o
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
restorecon: setfiles
|
|
|
|
ln -sf setfiles restorecon
|
|
|
|
|
2017-06-20 15:16:41 +00:00
|
|
|
restorecon_xattr: restorecon_xattr.o restore.o
|
2016-09-26 15:30:30 +00:00
|
|
|
|
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
|
2018-02-14 09:57:09 +00:00
|
|
|
[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
|
|
|
|
-mkdir -p $(DESTDIR)$(SBINDIR)
|
|
|
|
install -m 755 setfiles $(DESTDIR)$(SBINDIR)
|
|
|
|
(cd $(DESTDIR)$(SBINDIR) && ln -sf setfiles restorecon)
|
|
|
|
install -m 755 restorecon_xattr $(DESTDIR)$(SBINDIR)
|
|
|
|
install -m 644 setfiles.8.man $(DESTDIR)$(MANDIR)/man8/setfiles.8
|
|
|
|
install -m 644 restorecon.8 $(DESTDIR)$(MANDIR)/man8/restorecon.8
|
|
|
|
install -m 644 restorecon_xattr.8 $(DESTDIR)$(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
|
2018-02-14 09:57:09 +00:00
|
|
|
$(DESTDIR)$(SBINDIR)/restorecon $(DESTDIR)$(SBINDIR)/setfiles $(DESTDIR)$(SBINDIR)/restorecon_xattr
|