source: trunk/packages/xen-common/xen-common/tools/security/Makefile @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

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