Home | History | Annotate | Download | only in restorecond
      1 PKG_CONFIG ?= pkg-config
      2 
      3 # Installation directories.
      4 LINGUAS ?= ru
      5 PREFIX ?= /usr
      6 SBINDIR ?= $(PREFIX)/sbin
      7 MANDIR = $(PREFIX)/share/man
      8 AUTOSTARTDIR = /etc/xdg/autostart
      9 DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services
     10 SYSTEMDDIR ?= $(PREFIX)/lib/systemd
     11 
     12 autostart_DATA = sealertauto.desktop
     13 INITDIR ?= /etc/rc.d/init.d
     14 SELINUXDIR = /etc/selinux
     15 
     16 DBUSFLAGS = -DHAVE_DBUS $(shell $(PKG_CONFIG) --cflags dbus-glib-1)
     17 DBUSLIB = $(shell $(PKG_CONFIG) --libs dbus-glib-1)
     18 
     19 CFLAGS ?= -g -Werror -Wall -W
     20 override CFLAGS += $(DBUSFLAGS)
     21 
     22 override LDLIBS += -lselinux $(DBUSLIB)
     23 
     24 all: restorecond
     25 
     26 restorecond.o utmpwatcher.o stringslist.o user.o watch.o: restorecond.h
     27 
     28 restorecond:  restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o
     29 	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
     30 
     31 install: all
     32 	[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
     33 	-mkdir -p $(DESTDIR)$(SBINDIR)
     34 	install -m 755 restorecond $(DESTDIR)$(SBINDIR)
     35 	install -m 644 restorecond.8 $(DESTDIR)$(MANDIR)/man8
     36 	for lang in $(LINGUAS) ; do \
     37 		if [ -e $${lang} ] ; then \
     38 			[ -d $(DESTDIR)$(MANDIR)/$${lang}/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \
     39 			install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \
     40 		fi ; \
     41 	done
     42 	-mkdir -p $(DESTDIR)$(INITDIR)
     43 	install -m 755 restorecond.init $(DESTDIR)$(INITDIR)/restorecond
     44 	-mkdir -p $(DESTDIR)$(SELINUXDIR)
     45 	install -m 644 restorecond.conf $(DESTDIR)$(SELINUXDIR)/restorecond.conf
     46 	install -m 644 restorecond_user.conf $(DESTDIR)$(SELINUXDIR)/restorecond_user.conf
     47 	-mkdir -p $(DESTDIR)$(AUTOSTARTDIR)
     48 	install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop
     49 	-mkdir -p $(DESTDIR)$(DBUSSERVICEDIR)
     50 	install -m 644 org.selinux.Restorecond.service  $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service
     51 	-mkdir -p $(DESTDIR)$(SYSTEMDDIR)/system
     52 	install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDDIR)/system/
     53 relabel: install
     54 	/sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond 
     55 
     56 clean:
     57 	-rm -f restorecond *.o *~
     58 
     59 indent:
     60 	../../scripts/Lindent $(wildcard *.[ch])
     61 
     62 test:
     63