Home | History | Annotate | Download | only in run_init
      1 
      2 # Installation directories.
      3 LINGUAS ?= ru
      4 PREFIX ?= /usr
      5 SBINDIR ?= $(PREFIX)/sbin
      6 MANDIR ?= $(PREFIX)/share/man
      7 ETCDIR ?= /etc
      8 LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
      9 PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y)
     10 AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
     11 
     12 CFLAGS ?= -Werror -Wall -W
     13 override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
     14 override LDLIBS += -lselinux
     15 ifeq ($(PAMH), y)
     16 	override CFLAGS += -DUSE_PAM
     17 	override LDLIBS += -lpam -lpam_misc
     18 else
     19 	override CFLAGS += -D_XOPEN_SOURCE=500
     20 	override LDLIBS += -lcrypt
     21 endif
     22 ifeq ($(AUDITH), y)
     23 	override CFLAGS += -DUSE_AUDIT
     24 	override LDLIBS += -laudit
     25 endif
     26 
     27 TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
     28 
     29 all: $(TARGETS)
     30 
     31 open_init_pty: open_init_pty.c
     32 	$(LINK.c) $^ -ldl -lutil -o $@
     33 
     34 
     35 install: all
     36 	test -d $(DESTDIR)$(SBINDIR)      || install -m 755 -d $(DESTDIR)$(SBINDIR)
     37 	test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8
     38 	install -m 755 run_init $(DESTDIR)$(SBINDIR)
     39 	install -m 755 open_init_pty $(DESTDIR)$(SBINDIR)
     40 	install -m 644 run_init.8 $(DESTDIR)$(MANDIR)/man8/
     41 	install -m 644 open_init_pty.8 $(DESTDIR)$(MANDIR)/man8/
     42 	for lang in $(LINGUAS) ; do \
     43 		if [ -e $${lang} ] ; then \
     44 			test -d $(DESTDIR)$(MANDIR)/$${lang}/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \
     45 			install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \
     46 		fi ; \
     47 	done
     48 ifeq ($(PAMH), y)
     49 	install -m 644 run_init.pamd $(DESTDIR)$(ETCDIR)/pam.d/run_init
     50 endif
     51 
     52 clean:
     53 	-rm -f $(TARGETS) *.o 
     54 
     55 indent:
     56 	../../scripts/Lindent $(wildcard *.[ch])
     57 
     58 relabel: install
     59 	/sbin/restorecon $(DESTDIR)$(SBINDIR)/run_init $(DESTDIR)$(SBINDIR)/open_init_pty
     60