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