2018-02-14 09:57:14 +00:00
|
|
|
PREFIX ?= /usr
|
2015-03-31 14:17:01 +00:00
|
|
|
BINDIR ?= $(PREFIX)/bin
|
|
|
|
MANDIR ?= $(PREFIX)/share/man
|
|
|
|
|
|
|
|
SECILC = secilc
|
|
|
|
SECILC_SRCS := secilc.c
|
|
|
|
SECILC_OBJS := $(patsubst %.c,%.o,$(SECILC_SRCS))
|
|
|
|
|
2016-11-28 18:13:38 +00:00
|
|
|
SECIL2CONF = secil2conf
|
|
|
|
SECIL2CONF_SRCS := secil2conf.c
|
|
|
|
SECIL2CONF_OBJS := $(patsubst %.c,%.o,$(SECIL2CONF_SRCS))
|
|
|
|
|
|
|
|
SECILC_MANPAGE = secilc.8
|
|
|
|
SECIL2CONF_MANPAGE = secil2conf.8
|
2015-03-31 14:17:01 +00:00
|
|
|
XMLTO = xmlto
|
2020-03-16 09:55:23 +00:00
|
|
|
DIFF = diff
|
|
|
|
|
|
|
|
CHECKPOLICY = checkpolicy
|
|
|
|
POL_VERS = $(shell $(CHECKPOLICY) -V | cut -f 1 -d ' ')
|
2015-03-31 14:17:01 +00:00
|
|
|
|
|
|
|
CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused
|
|
|
|
|
2017-04-24 17:59:56 +00:00
|
|
|
override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
|
2017-06-20 15:16:41 +00:00
|
|
|
override LDLIBS += -lsepol
|
2015-03-31 14:17:01 +00:00
|
|
|
|
2016-11-28 18:13:38 +00:00
|
|
|
all: $(SECILC) $(SECIL2CONF) man
|
2016-01-08 14:31:15 +00:00
|
|
|
|
2015-03-31 14:17:01 +00:00
|
|
|
$(SECILC): $(SECILC_OBJS)
|
2017-04-24 17:59:56 +00:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
2015-03-31 14:17:01 +00:00
|
|
|
|
|
|
|
test: $(SECILC)
|
|
|
|
./$(SECILC) test/policy.cil
|
2020-03-16 09:55:23 +00:00
|
|
|
./$(SECILC) -c $(POL_VERS) -O -M 1 -f /dev/null -o opt-actual.bin test/opt-input.cil
|
|
|
|
$(CHECKPOLICY) -b -C -M -o opt-actual.cil opt-actual.bin >/dev/null
|
|
|
|
$(DIFF) test/opt-expected.cil opt-actual.cil
|
2015-03-31 14:17:01 +00:00
|
|
|
|
2016-11-28 18:13:38 +00:00
|
|
|
$(SECIL2CONF): $(SECIL2CONF_OBJS)
|
2017-04-24 17:59:56 +00:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
2016-11-28 18:13:38 +00:00
|
|
|
|
|
|
|
man: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE)
|
|
|
|
|
|
|
|
$(SECILC_MANPAGE): $(SECILC_MANPAGE).xml
|
|
|
|
$(XMLTO) man $(SECILC_MANPAGE).xml
|
2016-11-14 21:33:24 +00:00
|
|
|
|
2016-11-28 18:13:38 +00:00
|
|
|
$(SECIL2CONF_MANPAGE): $(SECIL2CONF_MANPAGE).xml
|
|
|
|
$(XMLTO) man $(SECIL2CONF_MANPAGE).xml
|
2015-03-31 14:17:01 +00:00
|
|
|
|
|
|
|
install: all man
|
2018-02-14 09:57:14 +00:00
|
|
|
-mkdir -p $(DESTDIR)$(BINDIR)
|
|
|
|
-mkdir -p $(DESTDIR)$(MANDIR)/man8
|
|
|
|
install -m 755 $(SECILC) $(DESTDIR)$(BINDIR)
|
|
|
|
install -m 755 $(SECIL2CONF) $(DESTDIR)$(BINDIR)
|
|
|
|
install -m 644 $(SECILC_MANPAGE) $(DESTDIR)$(MANDIR)/man8
|
|
|
|
install -m 644 $(SECIL2CONF_MANPAGE) $(DESTDIR)$(MANDIR)/man8
|
2015-03-31 14:17:01 +00:00
|
|
|
|
|
|
|
doc:
|
|
|
|
$(MAKE) -C docs
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(SECILC)
|
|
|
|
rm -f $(SECILC_OBJS)
|
2016-11-28 18:13:38 +00:00
|
|
|
rm -f $(SECIL2CONF)
|
|
|
|
rm -f $(SECIL2CONF_OBJS)
|
2015-03-31 14:17:01 +00:00
|
|
|
rm -f policy.*
|
|
|
|
rm -f file_contexts
|
2016-11-28 18:13:38 +00:00
|
|
|
rm -f $(SECILC_MANPAGE)
|
|
|
|
rm -f $(SECIL2CONF_MANPAGE)
|
2020-03-16 09:55:23 +00:00
|
|
|
rm -f opt-actual.cil
|
|
|
|
rm -f opt-actual.bin
|
2018-05-28 14:30:16 +00:00
|
|
|
$(MAKE) -C docs clean
|
2015-03-31 14:17:01 +00:00
|
|
|
|
2015-04-10 13:50:57 +00:00
|
|
|
relabel:
|
|
|
|
|
2016-01-08 14:31:15 +00:00
|
|
|
.PHONY: all clean test install doc relabel man
|