1# Installation directories.
2PREFIX ?= $(DESTDIR)/usr
3SBINDIR ?= $(PREFIX)/sbin
4LIBDIR ?= $(PREFIX)/lib
5MANDIR = $(PREFIX)/share/man
6AUTOSTARTDIR = $(DESTDIR)/etc/xdg/autostart
7DBUSSERVICEDIR = $(DESTDIR)/usr/share/dbus-1/services
8SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
9
10autostart_DATA = sealertauto.desktop
11INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
12SELINUXDIR = $(DESTDIR)/etc/selinux
13
14DBUSFLAGS = -DHAVE_DBUS -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/lib/dbus-1.0/include
15DBUSLIB = -ldbus-glib-1 -ldbus-1
16
17CFLAGS ?= -g -Werror -Wall -W
18override CFLAGS += -I$(PREFIX)/include $(DBUSFLAGS) -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib/glib-2.0/include
19
20LDLIBS += -lselinux $(DBUSLIB) -lglib-2.0 -L$(LIBDIR)
21
22all: restorecond
23
24restorecond.o utmpwatcher.o stringslist.o user.o watch.o: restorecond.h
25
26restorecond:  ../setfiles/restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o
27	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
28
29install: all
30	[ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8
31	-mkdir -p $(SBINDIR)
32	install -m 755 restorecond $(SBINDIR)
33	install -m 644 restorecond.8 $(MANDIR)/man8
34	-mkdir -p $(INITDIR)
35	install -m 755 restorecond.init $(INITDIR)/restorecond
36	-mkdir -p $(SELINUXDIR)
37	install -m 644 restorecond.conf $(SELINUXDIR)/restorecond.conf
38	install -m 644 restorecond_user.conf $(SELINUXDIR)/restorecond_user.conf
39	-mkdir -p $(AUTOSTARTDIR)
40	install -m 644 restorecond.desktop $(AUTOSTARTDIR)/restorecond.desktop
41	-mkdir -p $(DBUSSERVICEDIR)
42	install -m 600 org.selinux.Restorecond.service  $(DBUSSERVICEDIR)/org.selinux.Restorecond.service
43	-mkdir -p $(SYSTEMDDIR)/system
44	install -m 644 restorecond.service $(SYSTEMDDIR)/system/
45relabel: install
46	/sbin/restorecon $(SBINDIR)/restorecond
47
48clean:
49	-rm -f restorecond *.o *~
50
51indent:
52	../../scripts/Lindent $(wildcard *.[ch])
53
54