1 # Installation directories. 2 LINGUAS ?= ru 3 PREFIX ?= /usr 4 BINDIR ?= $(PREFIX)/bin 5 MANDIR ?= $(PREFIX)/share/man 6 ETCDIR ?= /etc 7 LOCALEDIR = $(DESTDIR)$(PREFIX)/share/locale 8 PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) 9 AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) 10 # Enable capabilities to permit newrole to generate audit records. 11 # This will make newrole a setuid root program. 12 # The capabilities used are: CAP_AUDIT_WRITE. 13 AUDIT_LOG_PRIV ?= n 14 # Enable capabilities to permit newrole to utilitize the pam_namespace module. 15 # This will make newrole a setuid root program. 16 # The capabilities used are: CAP_SYS_ADMIN, CAP_CHOWN, CAP_FOWNER and 17 # CAP_DAC_OVERRIDE. 18 NAMESPACE_PRIV ?= n 19 # If LSPP_PRIV is y, then newrole will be made into setuid root program. 20 # Enabling this option will force AUDIT_LOG_PRIV and NAMESPACE_PRIV to be y. 21 LSPP_PRIV ?= n 22 VERSION = $(shell cat ../VERSION) 23 24 CFLAGS ?= -Werror -Wall -W 25 EXTRA_OBJS = 26 override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" 27 override LDLIBS += -lselinux 28 ifeq ($(PAMH), y) 29 override CFLAGS += -DUSE_PAM 30 EXTRA_OBJS += hashtab.o 31 override LDLIBS += -lpam -lpam_misc 32 else 33 override CFLAGS += -D_XOPEN_SOURCE=500 34 override LDLIBS += -lcrypt 35 endif 36 ifeq ($(AUDITH), y) 37 override CFLAGS += -DUSE_AUDIT 38 override LDLIBS += -laudit 39 endif 40 ifeq ($(LSPP_PRIV),y) 41 override AUDIT_LOG_PRIV=y 42 override NAMESPACE_PRIV=y 43 endif 44 ifeq ($(AUDIT_LOG_PRIV),y) 45 override CFLAGS += -DAUDIT_LOG_PRIV 46 IS_SUID=y 47 endif 48 ifeq ($(NAMESPACE_PRIV),y) 49 override CFLAGS += -DNAMESPACE_PRIV 50 IS_SUID=y 51 endif 52 ifeq ($(IS_SUID),y) 53 MODE := 4555 54 override LDLIBS += -lcap-ng 55 else 56 MODE := 0555 57 endif 58 59 all: newrole 60 61 newrole: newrole.o $(EXTRA_OBJS) 62 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) 63 64 install: all 65 test -d $(DESTDIR)$(BINDIR) || install -m 755 -d $(DESTDIR)$(BINDIR) 66 test -d $(DESTDIR)$(ETCDIR)/pam.d || install -m 755 -d $(DESTDIR)$(ETCDIR)/pam.d 67 test -d $(DESTDIR)$(MANDIR)/man1 || install -m 755 -d $(DESTDIR)$(MANDIR)/man1 68 install -m $(MODE) newrole $(DESTDIR)$(BINDIR) 69 install -m 644 newrole.1 $(DESTDIR)$(MANDIR)/man1/ 70 for lang in $(LINGUAS) ; do \ 71 if [ -e $${lang} ] ; then \ 72 test -d $(DESTDIR)$(MANDIR)/$${lang}/man1 || install -m 755 -d $(DESTDIR)$(MANDIR)/$${lang}/man1 ; \ 73 install -m 644 $${lang}/*.1 $(DESTDIR)$(MANDIR)/$${lang}/man1/ ; \ 74 fi ; \ 75 done 76 ifeq ($(PAMH), y) 77 test -d $(DESTDIR)$(ETCDIR)/pam.d || install -m 755 -d $(DESTDIR)$(ETCDIR)/pam.d 78 ifeq ($(LSPP_PRIV),y) 79 install -m 644 newrole-lspp.pamd $(DESTDIR)$(ETCDIR)/pam.d/newrole 80 else 81 install -m 644 newrole.pamd $(DESTDIR)$(ETCDIR)/pam.d/newrole 82 endif 83 endif 84 85 clean: 86 rm -f newrole *.o 87 88 indent: 89 ../../scripts/Lindent $(wildcard *.[ch]) 90 91 relabel: install 92 /sbin/restorecon $(DESTDIR)$(BINDIR)/newrole 93