Home | History | Annotate | Download | only in restorecond
      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 += -I$(PREFIX)/include $(DBUSFLAGS)
     21 
     22 USE_PCRE2 ?= n
     23 ifeq ($(USE_PCRE2),y)
     24 	PCRE_LDFLAGS := -lpcre2-8
     25 else
     26 	PCRE_LDFLAGS := -lpcre
     27 endif
     28 
     29 LDLIBS += -lselinux $(PCRE_LDFLAGS) $(DBUSLIB) -L$(LIBDIR)
     30 
     31 all: restorecond
     32 
     33 restorecond.o utmpwatcher.o stringslist.o user.o watch.o: restorecond.h
     34 
     35 restorecond:  restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o
     36 	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
     37 
     38 install: 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/
     54 relabel: install
     55 	/sbin/restorecon $(SBINDIR)/restorecond 
     56 
     57 clean:
     58 	-rm -f restorecond *.o *~
     59 
     60 indent:
     61 	../../scripts/Lindent $(wildcard *.[ch])
     62 
     63 test:
     64