1 PREFIX ?= /usr 2 BINDIR ?= $(PREFIX)/bin 3 MANDIR ?= $(PREFIX)/share/man 4 5 SECILC = secilc 6 SECILC_SRCS := secilc.c 7 SECILC_OBJS := $(patsubst %.c,%.o,$(SECILC_SRCS)) 8 9 SECIL2CONF = secil2conf 10 SECIL2CONF_SRCS := secil2conf.c 11 SECIL2CONF_OBJS := $(patsubst %.c,%.o,$(SECIL2CONF_SRCS)) 12 13 SECILC_MANPAGE = secilc.8 14 SECIL2CONF_MANPAGE = secil2conf.8 15 XMLTO = xmlto 16 17 CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused 18 19 override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 20 override LDLIBS += -lsepol 21 22 all: $(SECILC) $(SECIL2CONF) man 23 24 $(SECILC): $(SECILC_OBJS) 25 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) 26 27 test: $(SECILC) 28 ./$(SECILC) test/policy.cil 29 30 $(SECIL2CONF): $(SECIL2CONF_OBJS) 31 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) 32 33 man: $(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 41 install: 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 49 doc: 50 $(MAKE) -C docs 51 52 clean: 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 63 relabel: 64 65 .PHONY: all clean test install doc relabel man 66