• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Installation directories.
2PREFIX ?= /usr
3SBINDIR ?= /sbin
4INITDIR ?= /etc/rc.d/init.d
5SYSTEMDDIR ?= $(PREFIX)/lib/systemd
6
7# If no specific libsepol.a is specified, fall back on LDFLAGS search path
8# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there
9# is no need to define a value for LDLIBS_LIBSEPOLA
10ifeq ($(LIBSEPOLA),)
11        LDLIBS_LIBSEPOLA := -l:libsepol.a
12endif
13
14PROG_SRC=mcstrans.c  mcscolor.c  mcstransd.c  mls_level.c
15PROG_OBJS= $(patsubst %.c,%.o,$(PROG_SRC))
16PROG=mcstransd
17INITSCRIPT=mcstrans
18CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
19
20all: $(PROG)
21
22$(PROG): $(PROG_OBJS) $(LIBSEPOLA)
23	$(CC) $(LDFLAGS) -pie -o $@ $^ -lselinux -lcap -lpcre $(LDLIBS_LIBSEPOLA)
24
25%.o:  %.c
26	$(CC) $(CFLAGS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIE -c -o $@ $<
27
28install: all
29	test -d $(DESTDIR)$(SBINDIR) || install -m 755 -d $(DESTDIR)$(SBINDIR)
30	install -m 755 $(PROG) $(DESTDIR)$(SBINDIR)
31	test -d $(DESTDIR)$(INITDIR) || install -m 755 -d $(DESTDIR)$(INITDIR)
32	install -m 755 $(INITSCRIPT).init $(DESTDIR)$(INITDIR)/$(INITSCRIPT)
33	test -d $(DESTDIR)$(SYSTEMDDIR)/system || install -m 755 -d $(DESTDIR)$(SYSTEMDDIR)/system
34	install -m 644 mcstrans.service $(DESTDIR)$(SYSTEMDDIR)/system/
35
36clean:
37	-rm -f $(OBJS) $(LOBJS) $(TARGET) $(PROG) $(PROG_OBJS) *~ \#*
38
39