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