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