1 # Installation directories. 2 PREFIX ?= $(DESTDIR)/usr 3 SBINDIR ?= $(DESTDIR)/sbin 4 MANDIR = $(PREFIX)/share/man 5 LIBDIR ?= $(PREFIX)/lib 6 AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) 7 8 ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }') 9 10 CFLAGS ?= -g -Werror -Wall -W 11 override LDLIBS += -lselinux -lsepol 12 13 ifeq ($(AUDITH), y) 14 override CFLAGS += -DUSE_AUDIT 15 override LDLIBS += -laudit 16 endif 17 18 all: setfiles restorecon restorecon_xattr man 19 20 setfiles: setfiles.o restore.o 21 22 restorecon: setfiles 23 ln -sf setfiles restorecon 24 25 restorecon_xattr: restorecon_xattr.o restore.o 26 27 man: 28 @cp -af setfiles.8 setfiles.8.man 29 @sed -i "s/ABORT_ON_ERRORS/$(ABORT_ON_ERRORS)/g" setfiles.8.man 30 31 install: all 32 [ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8 33 -mkdir -p $(SBINDIR) 34 install -m 755 setfiles $(SBINDIR) 35 (cd $(SBINDIR) && ln -sf setfiles restorecon) 36 install -m 755 restorecon_xattr $(SBINDIR) 37 install -m 644 setfiles.8.man $(MANDIR)/man8/setfiles.8 38 install -m 644 restorecon.8 $(MANDIR)/man8/restorecon.8 39 install -m 644 restorecon_xattr.8 $(MANDIR)/man8/restorecon_xattr.8 40 41 clean: 42 rm -f setfiles restorecon restorecon_xattr *.o setfiles.8.man 43 44 indent: 45 ../../scripts/Lindent $(wildcard *.[ch]) 46 47 relabel: install 48 $(SBINDIR)/restorecon $(SBINDIR)/setfiles $(SBINDIR)/restorecon_xattr 49