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
|
|
|
|
AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null)
|
|
|
|
|
2012-08-22 07:13:43 +00:00
|
|
|
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 }')
|
|
|
|
|
2009-09-10 18:54:35 +00:00
|
|
|
CFLAGS = -g -Werror -Wall -W
|
2009-07-06 13:49:39 +00:00
|
|
|
override CFLAGS += -I$(PREFIX)/include
|
2008-08-19 19:30:36 +00:00
|
|
|
LDLIBS = -lselinux -lsepol -L$(LIBDIR)
|
|
|
|
|
2011-09-19 20:38:33 +00:00
|
|
|
ifeq ($(AUDITH), /usr/include/libaudit.h)
|
2008-08-19 19:30:36 +00:00
|
|
|
override CFLAGS += -DUSE_AUDIT
|
|
|
|
LDLIBS += -laudit
|
|
|
|
endif
|
|
|
|
|
2012-08-22 07:13:43 +00:00
|
|
|
all: setfiles restorecon 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
|
|
|
|
|
2012-08-22 07:13:43 +00:00
|
|
|
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
|
|
|
|
|
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)
|
2012-08-22 07:13:43 +00:00
|
|
|
install -m 644 setfiles.8.man $(MANDIR)/man8/setfiles.8
|
|
|
|
install -m 644 restorecon.8.man $(MANDIR)/man8/restorecon.8
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
clean:
|
2012-08-22 07:13:43 +00:00
|
|
|
rm -f setfiles restorecon *.o setfiles.8.man restorecon.8.man
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
indent:
|
|
|
|
../../scripts/Lindent $(wildcard *.[ch])
|
|
|
|
|
|
|
|
relabel: install
|
2012-08-22 07:13:43 +00:00
|
|
|
$(SBINDIR)/restorecon $(SBINDIR)/setfiles
|