2016-10-30 19:15:08 +00:00
|
|
|
PKG_CONFIG ?= pkg-config
|
|
|
|
|
2008-08-19 19:30:36 +00:00
|
|
|
# Installation directories.
|
2018-02-14 09:57:12 +00:00
|
|
|
PREFIX ?= /usr
|
2008-08-19 19:30:36 +00:00
|
|
|
SBINDIR ?= $(PREFIX)/sbin
|
|
|
|
MANDIR = $(PREFIX)/share/man
|
2018-02-14 09:57:12 +00:00
|
|
|
AUTOSTARTDIR = /etc/xdg/autostart
|
|
|
|
DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services
|
|
|
|
SYSTEMDDIR ?= $(PREFIX)/lib/systemd
|
2011-08-03 15:40:47 +00:00
|
|
|
|
|
|
|
autostart_DATA = sealertauto.desktop
|
2013-10-09 21:36:36 +00:00
|
|
|
INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
|
2008-08-19 19:30:36 +00:00
|
|
|
SELINUXDIR = $(DESTDIR)/etc/selinux
|
|
|
|
|
2016-10-30 19:15:08 +00:00
|
|
|
DBUSFLAGS = -DHAVE_DBUS $(shell $(PKG_CONFIG) --cflags dbus-glib-1)
|
|
|
|
DBUSLIB = $(shell $(PKG_CONFIG) --libs dbus-glib-1)
|
2011-08-03 15:40:47 +00:00
|
|
|
|
2008-08-19 19:30:36 +00:00
|
|
|
CFLAGS ?= -g -Werror -Wall -W
|
2017-04-24 17:59:56 +00:00
|
|
|
override CFLAGS += $(DBUSFLAGS)
|
2011-08-03 15:40:47 +00:00
|
|
|
|
2016-09-15 16:14:33 +00:00
|
|
|
USE_PCRE2 ?= n
|
|
|
|
ifeq ($(USE_PCRE2),y)
|
2017-04-24 17:59:57 +00:00
|
|
|
PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8)
|
|
|
|
PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre2-8)
|
2016-09-15 16:14:33 +00:00
|
|
|
else
|
2017-04-24 17:59:57 +00:00
|
|
|
PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre)
|
|
|
|
PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre)
|
2016-09-15 16:14:33 +00:00
|
|
|
endif
|
2017-04-24 17:59:57 +00:00
|
|
|
export PCRE_CFLAGS PCRE_LDLIBS
|
2016-09-15 16:14:33 +00:00
|
|
|
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -lselinux $(PCRE_LDLIBS) $(DBUSLIB)
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
all: restorecond
|
|
|
|
|
2011-08-03 15:40:47 +00:00
|
|
|
restorecond.o utmpwatcher.o stringslist.o user.o watch.o: restorecond.h
|
|
|
|
|
2016-11-08 19:21:10 +00:00
|
|
|
restorecond: restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o
|
2008-08-19 19:30:36 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
|
|
|
|
|
|
|
install: all
|
2018-02-14 09:57:12 +00:00
|
|
|
[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
|
|
|
|
-mkdir -p $(DESTDIR)$(SBINDIR)
|
|
|
|
install -m 755 restorecond $(DESTDIR)$(SBINDIR)
|
|
|
|
install -m 644 restorecond.8 $(DESTDIR)$(MANDIR)/man8
|
2008-08-19 19:30:36 +00:00
|
|
|
-mkdir -p $(INITDIR)
|
2009-02-17 16:42:15 +00:00
|
|
|
install -m 755 restorecond.init $(INITDIR)/restorecond
|
2008-08-19 19:30:36 +00:00
|
|
|
-mkdir -p $(SELINUXDIR)
|
2011-08-03 15:40:47 +00:00
|
|
|
install -m 644 restorecond.conf $(SELINUXDIR)/restorecond.conf
|
|
|
|
install -m 644 restorecond_user.conf $(SELINUXDIR)/restorecond_user.conf
|
2018-02-14 09:57:12 +00:00
|
|
|
-mkdir -p $(DESTDIR)$(AUTOSTARTDIR)
|
|
|
|
install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop
|
|
|
|
-mkdir -p $(DESTDIR)$(DBUSSERVICEDIR)
|
|
|
|
install -m 600 org.selinux.Restorecond.service $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service
|
|
|
|
-mkdir -p $(DESTDIR)$(SYSTEMDDIR)/system
|
|
|
|
install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDDIR)/system/
|
2008-08-19 19:30:36 +00:00
|
|
|
relabel: install
|
2018-02-14 09:57:12 +00:00
|
|
|
/sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond
|
2008-08-19 19:30:36 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -f restorecond *.o *~
|
|
|
|
|
|
|
|
indent:
|
|
|
|
../../scripts/Lindent $(wildcard *.[ch])
|
|
|
|
|
2016-11-16 14:05:20 +00:00
|
|
|
test:
|