• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 += $(DBUSFLAGS)
21
22USE_PCRE2 ?= n
23ifeq ($(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)
26else
27	PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre)
28	PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre)
29endif
30export PCRE_CFLAGS PCRE_LDLIBS
31
32override LDLIBS += -lselinux $(PCRE_LDLIBS) $(DBUSLIB)
33
34all: restorecond
35
36restorecond.o utmpwatcher.o stringslist.o user.o watch.o: restorecond.h
37
38restorecond:  restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o
39	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
40
41install: 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/
57relabel: install
58	/sbin/restorecon $(SBINDIR)/restorecond
59
60clean:
61	-rm -f restorecond *.o *~
62
63indent:
64	../../scripts/Lindent $(wildcard *.[ch])
65
66test:
67