1 2 # Installation directories. 3 PREFIX ?= $(DESTDIR)/usr 4 SBINDIR ?= $(PREFIX)/sbin 5 MANDIR ?= $(PREFIX)/share/man 6 ETCDIR ?= $(DESTDIR)/etc 7 LOCALEDIR ?= /usr/share/locale 8 PAMH = $(shell ls /usr/include/security/pam_appl.h 2>/dev/null) 9 AUDITH = $(shell ls /usr/include/libaudit.h 2>/dev/null) 10 11 CFLAGS ?= -Werror -Wall -W 12 override CFLAGS += -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\"" 13 LDLIBS += -lselinux -L$(PREFIX)/lib 14 ifeq ($(PAMH), /usr/include/security/pam_appl.h) 15 override CFLAGS += -DUSE_PAM 16 LDLIBS += -lpam -lpam_misc 17 else 18 override CFLAGS += -D_XOPEN_SOURCE=500 19 LDLIBS += -lcrypt 20 endif 21 ifeq ($(AUDITH), /usr/include/libaudit.h) 22 override CFLAGS += -DUSE_AUDIT 23 LDLIBS += -laudit 24 endif 25 26 TARGETS=$(patsubst %.c,%,$(wildcard *.c)) 27 28 all: $(TARGETS) 29 30 open_init_pty: open_init_pty.c 31 $(LINK.c) $^ -ldl -lutil -o $@ 32 33 34 install: all 35 test -d $(SBINDIR) || install -m 755 -d $(SBINDIR) 36 test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 37 install -m 755 run_init $(SBINDIR) 38 install -m 755 open_init_pty $(SBINDIR) 39 install -m 644 run_init.8 $(MANDIR)/man8/ 40 install -m 644 open_init_pty.8 $(MANDIR)/man8/ 41 ifeq ($(PAMH), /usr/include/security/pam_appl.h) 42 install -m 644 run_init.pamd $(ETCDIR)/pam.d/run_init 43 endif 44 45 clean: 46 -rm -f $(TARGETS) *.o 47 48 indent: 49 ../../scripts/Lindent $(wildcard *.[ch]) 50 51 relabel: install 52 /sbin/restorecon $(SBINDIR)/run_init $(SBINDIR)/open_init_pty 53