16cd6a6acSopenharmony_ciPREFIX ?= /usr 26cd6a6acSopenharmony_ciBINDIR ?= $(PREFIX)/bin 36cd6a6acSopenharmony_ciMANDIR ?= $(PREFIX)/share/man 46cd6a6acSopenharmony_ci 56cd6a6acSopenharmony_ciSECILC = secilc 66cd6a6acSopenharmony_ciSECILC_SRCS := secilc.c 76cd6a6acSopenharmony_ciSECILC_OBJS := $(patsubst %.c,%.o,$(SECILC_SRCS)) 86cd6a6acSopenharmony_ci 96cd6a6acSopenharmony_ciSECIL2CONF = secil2conf 106cd6a6acSopenharmony_ciSECIL2CONF_SRCS := secil2conf.c 116cd6a6acSopenharmony_ciSECIL2CONF_OBJS := $(patsubst %.c,%.o,$(SECIL2CONF_SRCS)) 126cd6a6acSopenharmony_ci 136cd6a6acSopenharmony_ciSECIL2TREE = secil2tree 146cd6a6acSopenharmony_ciSECIL2TREE_SRCS := secil2tree.c 156cd6a6acSopenharmony_ciSECIL2TREE_OBJS := $(patsubst %.c,%.o,$(SECIL2TREE_SRCS)) 166cd6a6acSopenharmony_ci 176cd6a6acSopenharmony_ciSECILC_MANPAGE = secilc.8 186cd6a6acSopenharmony_ciSECIL2CONF_MANPAGE = secil2conf.8 196cd6a6acSopenharmony_ciSECIL2TREE_MANPAGE = secil2tree.8 206cd6a6acSopenharmony_ciXMLTO = xmlto 216cd6a6acSopenharmony_ciDIFF = diff 226cd6a6acSopenharmony_ci 236cd6a6acSopenharmony_ciCHECKPOLICY = checkpolicy 246cd6a6acSopenharmony_ciPOL_VERS = $(shell $(CHECKPOLICY) -V | cut -f 1 -d ' ') 256cd6a6acSopenharmony_ci 266cd6a6acSopenharmony_ciCFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused 276cd6a6acSopenharmony_ci 286cd6a6acSopenharmony_cioverride CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 296cd6a6acSopenharmony_cioverride LDLIBS += -lsepol 306cd6a6acSopenharmony_ci 316cd6a6acSopenharmony_ciall: $(SECILC) $(SECIL2CONF) $(SECIL2TREE) man 326cd6a6acSopenharmony_ci 336cd6a6acSopenharmony_ci$(SECILC): $(SECILC_OBJS) 346cd6a6acSopenharmony_ci $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) 356cd6a6acSopenharmony_ci 366cd6a6acSopenharmony_citest: $(SECILC) 376cd6a6acSopenharmony_ci ./$(SECILC) test/policy.cil 386cd6a6acSopenharmony_ci ./$(SECILC) -c $(POL_VERS) -O -M 1 -f /dev/null -o opt-actual.bin test/opt-input.cil 396cd6a6acSopenharmony_ci $(CHECKPOLICY) -b -C -M -o opt-actual.cil opt-actual.bin >/dev/null 406cd6a6acSopenharmony_ci $(DIFF) test/opt-expected.cil opt-actual.cil 416cd6a6acSopenharmony_ci 426cd6a6acSopenharmony_ci$(SECIL2CONF): $(SECIL2CONF_OBJS) 436cd6a6acSopenharmony_ci $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) 446cd6a6acSopenharmony_ci 456cd6a6acSopenharmony_ci$(SECIL2TREE): $(SECIL2TREE_OBJS) 466cd6a6acSopenharmony_ci $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) 476cd6a6acSopenharmony_ci 486cd6a6acSopenharmony_ciman: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE) $(SECIL2TREE_MANPAGE) 496cd6a6acSopenharmony_ci 506cd6a6acSopenharmony_ci$(SECILC_MANPAGE): $(SECILC_MANPAGE).xml 516cd6a6acSopenharmony_ci $(XMLTO) man $(SECILC_MANPAGE).xml 526cd6a6acSopenharmony_ci 536cd6a6acSopenharmony_ci$(SECIL2CONF_MANPAGE): $(SECIL2CONF_MANPAGE).xml 546cd6a6acSopenharmony_ci $(XMLTO) man $(SECIL2CONF_MANPAGE).xml 556cd6a6acSopenharmony_ci 566cd6a6acSopenharmony_ci$(SECIL2TREE_MANPAGE): $(SECIL2TREE_MANPAGE).xml 576cd6a6acSopenharmony_ci $(XMLTO) man $(SECIL2TREE_MANPAGE).xml 586cd6a6acSopenharmony_ci 596cd6a6acSopenharmony_ciinstall: all man 606cd6a6acSopenharmony_ci -mkdir -p $(DESTDIR)$(BINDIR) 616cd6a6acSopenharmony_ci -mkdir -p $(DESTDIR)$(MANDIR)/man8 626cd6a6acSopenharmony_ci install -m 755 $(SECILC) $(DESTDIR)$(BINDIR) 636cd6a6acSopenharmony_ci install -m 755 $(SECIL2CONF) $(DESTDIR)$(BINDIR) 646cd6a6acSopenharmony_ci install -m 755 $(SECIL2TREE) $(DESTDIR)$(BINDIR) 656cd6a6acSopenharmony_ci install -m 644 $(SECILC_MANPAGE) $(DESTDIR)$(MANDIR)/man8 666cd6a6acSopenharmony_ci install -m 644 $(SECIL2CONF_MANPAGE) $(DESTDIR)$(MANDIR)/man8 676cd6a6acSopenharmony_ci install -m 644 $(SECIL2TREE_MANPAGE) $(DESTDIR)$(MANDIR)/man8 686cd6a6acSopenharmony_ci 696cd6a6acSopenharmony_cidoc: 706cd6a6acSopenharmony_ci $(MAKE) -C docs 716cd6a6acSopenharmony_ci 726cd6a6acSopenharmony_ciclean: 736cd6a6acSopenharmony_ci rm -f $(SECILC) 746cd6a6acSopenharmony_ci rm -f $(SECILC_OBJS) 756cd6a6acSopenharmony_ci rm -f $(SECIL2CONF) 766cd6a6acSopenharmony_ci rm -f $(SECIL2CONF_OBJS) 776cd6a6acSopenharmony_ci rm -f $(SECIL2TREE) 786cd6a6acSopenharmony_ci rm -f $(SECIL2TREE_OBJS) 796cd6a6acSopenharmony_ci rm -f policy.* 806cd6a6acSopenharmony_ci rm -f file_contexts 816cd6a6acSopenharmony_ci rm -f $(SECILC_MANPAGE) 826cd6a6acSopenharmony_ci rm -f $(SECIL2CONF_MANPAGE) 836cd6a6acSopenharmony_ci rm -f $(SECIL2TREE_MANPAGE) 846cd6a6acSopenharmony_ci rm -f opt-actual.cil 856cd6a6acSopenharmony_ci rm -f opt-actual.bin 866cd6a6acSopenharmony_ci $(MAKE) -C docs clean 876cd6a6acSopenharmony_ci 886cd6a6acSopenharmony_cirelabel: 896cd6a6acSopenharmony_ci 906cd6a6acSopenharmony_ci.PHONY: all clean test install doc relabel man 91