1# Installation directories. 2LINGUAS ?= ru 3PREFIX ?= /usr 4SBINDIR ?= /sbin 5MANDIR = $(PREFIX)/share/man 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 $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 33 -mkdir -p $(DESTDIR)$(SBINDIR) 34 install -m 755 setfiles $(DESTDIR)$(SBINDIR) 35 (cd $(DESTDIR)$(SBINDIR) && ln -sf setfiles restorecon) 36 install -m 755 restorecon_xattr $(DESTDIR)$(SBINDIR) 37 install -m 644 setfiles.8.man $(DESTDIR)$(MANDIR)/man8/setfiles.8 38 install -m 644 restorecon.8 $(DESTDIR)$(MANDIR)/man8/restorecon.8 39 install -m 644 restorecon_xattr.8 $(DESTDIR)$(MANDIR)/man8/restorecon_xattr.8 40 for lang in $(LINGUAS) ; do \ 41 if [ -e $${lang} ] ; then \ 42 [ -d $(DESTDIR)$(MANDIR)/$${lang}/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \ 43 install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \ 44 fi ; \ 45 done 46 47clean: 48 rm -f setfiles restorecon restorecon_xattr *.o setfiles.8.man 49 50indent: 51 ../../scripts/Lindent $(wildcard *.[ch]) 52 53relabel: install 54 $(DESTDIR)$(SBINDIR)/restorecon $(DESTDIR)$(SBINDIR)/setfiles $(DESTDIR)$(SBINDIR)/restorecon_xattr 55