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