[34] | 1 | XEN_ROOT = ../.. |
---|
| 2 | include $(XEN_ROOT)/tools/Rules.mk |
---|
| 3 | |
---|
| 4 | CFLAGS += -Werror |
---|
| 5 | CFLAGS += -fno-strict-aliasing |
---|
| 6 | CFLAGS += -I. -I $(XEN_LIBXC) |
---|
| 7 | |
---|
| 8 | CPPFLAGS += -MMD -MF .$*.d |
---|
| 9 | PROG_DEPS = .*.d |
---|
| 10 | |
---|
| 11 | XML2VERSION = $(shell xml2-config --version ) |
---|
| 12 | CFLAGS += $(shell xml2-config --cflags ) |
---|
| 13 | CFLAGS += $(shell if [[ $(XML2VERSION) < 2.6.20 ]]; then echo ""; else echo "-DVALIDATE_SCHEMA"; fi ) |
---|
| 14 | LDFLAGS += $(shell xml2-config --libs ) # if this does not work, try -L/usr/lib -lxml2 -lz -lpthread -lm |
---|
| 15 | |
---|
| 16 | ifeq ($(ACM_DEFAULT_SECURITY_POLICY),ACM_NULL_POLICY) |
---|
| 17 | POLICY=null |
---|
| 18 | endif |
---|
| 19 | ifeq ($(ACM_DEFAULT_SECURITY_POLICY),ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY) |
---|
| 20 | POLICY=chwall_ste |
---|
| 21 | endif |
---|
| 22 | |
---|
| 23 | SRCS_TOOL = secpol_tool.c |
---|
| 24 | OBJS_TOOL := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_TOOL))) |
---|
| 25 | SRCS_XML2BIN = secpol_xml2bin.c secpol_xml2bin.h |
---|
| 26 | OBJS_XML2BIN := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_XML2BIN))) |
---|
| 27 | |
---|
| 28 | ACM_INST_TOOLS = xensec_tool xensec_xml2bin xensec_gen |
---|
| 29 | ACM_EZPOLICY = xensec_ezpolicy |
---|
| 30 | ACM_OBJS = $(OBJS_TOOL) $(OBJS_XML2BIN) $(OBJS_GETD) |
---|
| 31 | ACM_SCRIPTS = python/xensec_tools/acm_getlabel |
---|
| 32 | |
---|
| 33 | ACM_CONFIG_DIR = /etc/xen/acm-security |
---|
| 34 | ACM_POLICY_DIR = $(ACM_CONFIG_DIR)/policies |
---|
| 35 | ACM_SCRIPT_DIR = $(ACM_CONFIG_DIR)/scripts |
---|
| 36 | |
---|
| 37 | ACM_INST_HTML = python/xensec_gen/index.html |
---|
| 38 | ACM_INST_CGI = python/xensec_gen/cgi-bin/policy.cgi |
---|
| 39 | ACM_SECGEN_HTMLDIR= /var/lib/xensec_gen |
---|
| 40 | ACM_SECGEN_CGIDIR = $(ACM_SECGEN_HTMLDIR)/cgi-bin |
---|
| 41 | |
---|
| 42 | ACM_SCHEMA = security_policy.xsd |
---|
| 43 | ACM_EXAMPLES = client_v1 test |
---|
| 44 | ACM_POLICY_SUFFIX = security_policy.xml |
---|
| 45 | |
---|
| 46 | ifeq ($(ACM_SECURITY),y) |
---|
| 47 | .PHONY: all |
---|
| 48 | all: build |
---|
| 49 | |
---|
| 50 | .PHONY: install |
---|
| 51 | ifndef XEN_PYTHON_NATIVE_INSTALL |
---|
| 52 | install: LIBPATH=$(shell PYTHONPATH=../python/xen/util python -c "import auxbin; print auxbin.libpath()") |
---|
| 53 | endif |
---|
| 54 | install: all $(ACM_CONFIG_FILE) |
---|
| 55 | $(INSTALL_DIR) $(DESTDIR)/usr/sbin |
---|
| 56 | $(INSTALL_PROG) $(ACM_INST_TOOLS) $(DESTDIR)/usr/sbin |
---|
| 57 | $(INSTALL_PROG) $(ACM_EZPOLICY) $(DESTDIR)/usr/sbin |
---|
| 58 | $(INSTALL_DIR) $(DESTDIR)$(ACM_CONFIG_DIR) |
---|
| 59 | $(INSTALL_DIR) $(DESTDIR)$(ACM_POLICY_DIR) |
---|
| 60 | $(INSTALL_DATA) policies/$(ACM_SCHEMA) $(DESTDIR)$(ACM_POLICY_DIR) |
---|
| 61 | $(INSTALL_DIR) $(DESTDIR)$(ACM_POLICY_DIR)/example |
---|
| 62 | for i in $(ACM_EXAMPLES); do \ |
---|
| 63 | $(INSTALL_DATA) policies/example/$$i-$(ACM_POLICY_SUFFIX) $(DESTDIR)$(ACM_POLICY_DIR)/example/; \ |
---|
| 64 | done |
---|
| 65 | $(INSTALL_DIR) $(DESTDIR)$(ACM_SCRIPT_DIR) |
---|
| 66 | $(INSTALL_PROG) $(ACM_SCRIPTS) $(DESTDIR)$(ACM_SCRIPT_DIR) |
---|
| 67 | $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_HTMLDIR) |
---|
| 68 | $(INSTALL_DATA) $(ACM_INST_HTML) $(DESTDIR)$(ACM_SECGEN_HTMLDIR) |
---|
| 69 | $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR) |
---|
| 70 | $(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR) |
---|
| 71 | ifndef XEN_PYTHON_NATIVE_INSTALL |
---|
| 72 | python python/setup.py install --home="$(DESTDIR)/usr" --install-lib="$(DESTDIR)$(LIBPATH)/python" |
---|
| 73 | else |
---|
| 74 | python python/setup.py install --root="$(DESTDIR)" |
---|
| 75 | endif |
---|
| 76 | else |
---|
| 77 | .PHONY: all |
---|
| 78 | all: |
---|
| 79 | |
---|
| 80 | .PHONY: install |
---|
| 81 | install: |
---|
| 82 | endif |
---|
| 83 | |
---|
| 84 | .PHONY: build |
---|
| 85 | build: $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS) |
---|
| 86 | python python/setup.py build |
---|
| 87 | chmod 700 $(ACM_SCRIPTS) |
---|
| 88 | |
---|
| 89 | xensec_tool: $(OBJS_TOOL) |
---|
| 90 | $(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ -L$(XEN_LIBXC) -lxenctrl |
---|
| 91 | |
---|
| 92 | xensec_xml2bin: $(OBJS_XML2BIN) |
---|
| 93 | $(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ |
---|
| 94 | |
---|
| 95 | xensec_gen: xensec_gen.py |
---|
| 96 | cp -f $^ $@ |
---|
| 97 | |
---|
| 98 | .PHONY: clean |
---|
| 99 | clean: |
---|
| 100 | $(RM) $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS) |
---|
| 101 | $(RM) $(ACM_OBJS) |
---|
| 102 | $(RM) $(PROG_DEPS) |
---|
| 103 | $(RM) -r build |
---|
| 104 | |
---|
| 105 | .PHONY: mrproper |
---|
| 106 | mrproper: clean |
---|
| 107 | |
---|
| 108 | -include $(PROG_DEPS) |
---|