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