• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1PREFIX ?= /usr
2BINDIR ?= $(PREFIX)/bin
3MANDIR ?= $(PREFIX)/share/man
4
5SECILC = secilc
6SECILC_SRCS := secilc.c
7SECILC_OBJS := $(patsubst %.c,%.o,$(SECILC_SRCS))
8
9SECIL2CONF = secil2conf
10SECIL2CONF_SRCS := secil2conf.c
11SECIL2CONF_OBJS := $(patsubst %.c,%.o,$(SECIL2CONF_SRCS))
12
13SECILC_MANPAGE = secilc.8
14SECIL2CONF_MANPAGE = secil2conf.8
15XMLTO = xmlto
16
17CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused
18
19override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
20override LDLIBS += -lsepol
21
22all: $(SECILC) $(SECIL2CONF) man
23
24$(SECILC): $(SECILC_OBJS)
25	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
26
27test: $(SECILC)
28	./$(SECILC) test/policy.cil
29
30$(SECIL2CONF): $(SECIL2CONF_OBJS)
31	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
32
33man: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE)
34
35$(SECILC_MANPAGE): $(SECILC_MANPAGE).xml
36	$(XMLTO) man $(SECILC_MANPAGE).xml
37
38$(SECIL2CONF_MANPAGE): $(SECIL2CONF_MANPAGE).xml
39	$(XMLTO) man $(SECIL2CONF_MANPAGE).xml
40
41install: all man
42	-mkdir -p $(DESTDIR)$(BINDIR)
43	-mkdir -p $(DESTDIR)$(MANDIR)/man8
44	install -m 755 $(SECILC) $(DESTDIR)$(BINDIR)
45	install -m 755 $(SECIL2CONF) $(DESTDIR)$(BINDIR)
46	install -m 644 $(SECILC_MANPAGE) $(DESTDIR)$(MANDIR)/man8
47	install -m 644 $(SECIL2CONF_MANPAGE) $(DESTDIR)$(MANDIR)/man8
48
49doc:
50	$(MAKE) -C docs
51
52clean:
53	rm -f $(SECILC)
54	rm -f $(SECILC_OBJS)
55	rm -f $(SECIL2CONF)
56	rm -f $(SECIL2CONF_OBJS)
57	rm -f policy.*
58	rm -f file_contexts
59	rm -f $(SECILC_MANPAGE)
60	rm -f $(SECIL2CONF_MANPAGE)
61	$(MAKE) -C docs clean
62
63relabel:
64
65.PHONY: all clean test install doc relabel man
66