Home | History | Annotate | Download | only in setfiles
      1 # Installation directories.
      2 LINGUAS ?= ru
      3 PREFIX ?= /usr
      4 SBINDIR ?= /sbin
      5 MANDIR = $(PREFIX)/share/man
      6 AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
      7 
      8 ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }')
      9 
     10 CFLAGS ?= -g -Werror -Wall -W
     11 override LDLIBS += -lselinux -lsepol
     12 
     13 ifeq ($(AUDITH), y)
     14 	override CFLAGS += -DUSE_AUDIT
     15 	override LDLIBS += -laudit
     16 endif
     17 
     18 all: setfiles restorecon restorecon_xattr man
     19 
     20 setfiles: setfiles.o restore.o
     21 
     22 restorecon: setfiles
     23 	ln -sf setfiles restorecon
     24 
     25 restorecon_xattr: restorecon_xattr.o restore.o
     26 
     27 man:
     28 	@cp -af setfiles.8 setfiles.8.man
     29 	@sed -i "s/ABORT_ON_ERRORS/$(ABORT_ON_ERRORS)/g" setfiles.8.man
     30 
     31 install: 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 
     47 clean:
     48 	rm -f setfiles restorecon restorecon_xattr *.o setfiles.8.man
     49 
     50 indent:
     51 	../../scripts/Lindent $(wildcard *.[ch])
     52 
     53 relabel: install
     54 	$(DESTDIR)$(SBINDIR)/restorecon $(DESTDIR)$(SBINDIR)/setfiles $(DESTDIR)$(SBINDIR)/restorecon_xattr
     55