ia64/xen-unstable

view tools/security/Makefile @ 15848:9cc5858c145d

Check for libxml2 if security tools are to be built, and adapt the
python setup.py command line parameters to also work under SuSE.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author kfraser@localhost.localdomain
date Fri Sep 07 09:48:35 2007 +0100 (2007-09-07)
parents 92e43b36d211
children 5255eac35270
line source
1 XEN_ROOT = ../..
2 include $(XEN_ROOT)/tools/Rules.mk
4 CFLAGS += -Werror
5 CFLAGS += -fno-strict-aliasing
6 CFLAGS += -I. -I $(XEN_LIBXC)
8 CPPFLAGS += -MMD -MF .$*.d
9 PROG_DEPS = .*.d
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
16 SRCS_TOOL = secpol_tool.c
17 OBJS_TOOL := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_TOOL)))
18 SRCS_XML2BIN = secpol_xml2bin.c secpol_xml2bin.h
19 OBJS_XML2BIN := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_XML2BIN)))
21 ACM_INST_TOOLS = xensec_tool xensec_xml2bin xensec_gen
22 ACM_EZPOLICY = xensec_ezpolicy
23 ACM_OBJS = $(OBJS_TOOL) $(OBJS_XML2BIN) $(OBJS_GETD)
24 ACM_SCRIPTS = python/xensec_tools/acm_getlabel
26 ACM_CONFIG_DIR = /etc/xen/acm-security
27 ACM_POLICY_DIR = $(ACM_CONFIG_DIR)/policies
28 ACM_SCRIPT_DIR = $(ACM_CONFIG_DIR)/scripts
30 ACM_INST_HTML = python/xensec_gen/index.html
31 ACM_INST_CGI = python/xensec_gen/cgi-bin/policy.cgi
32 ACM_SECGEN_HTMLDIR= /var/lib/xensec_gen
33 ACM_SECGEN_CGIDIR = $(ACM_SECGEN_HTMLDIR)/cgi-bin
35 ACM_SCHEMA = security_policy.xsd
36 ACM_EXAMPLES = client_v1 test
37 ACM_DEF_POLICIES = default default-ul
38 ACM_POLICY_SUFFIX = security_policy.xml
40 ifeq ($(ACM_SECURITY),y)
41 .PHONY: all
42 all: build
44 .PHONY: install
45 ifndef XEN_PYTHON_NATIVE_INSTALL
46 install: LIBPATH=$(shell PYTHONPATH=../python/xen/util python -c "import auxbin; print auxbin.libpath()")
47 endif
48 install: all $(ACM_CONFIG_FILE)
49 $(INSTALL_DIR) $(DESTDIR)/usr/sbin
50 $(INSTALL_PROG) $(ACM_INST_TOOLS) $(DESTDIR)/usr/sbin
51 $(INSTALL_PROG) $(ACM_EZPOLICY) $(DESTDIR)/usr/sbin
52 $(INSTALL_DIR) $(DESTDIR)$(ACM_CONFIG_DIR)
53 $(INSTALL_DIR) $(DESTDIR)$(ACM_POLICY_DIR)
54 $(INSTALL_DATA) policies/$(ACM_SCHEMA) $(DESTDIR)$(ACM_POLICY_DIR)
55 $(INSTALL_DIR) $(DESTDIR)$(ACM_POLICY_DIR)/example
56 for i in $(ACM_EXAMPLES); do \
57 $(INSTALL_DATA) policies/example/$$i-$(ACM_POLICY_SUFFIX) $(DESTDIR)$(ACM_POLICY_DIR)/example/; \
58 done
59 for i in $(ACM_DEF_POLICIES); do \
60 $(INSTALL_DATA) policies/$$i-$(ACM_POLICY_SUFFIX) $(DESTDIR)$(ACM_POLICY_DIR); \
61 done
62 $(INSTALL_DIR) $(DESTDIR)$(ACM_SCRIPT_DIR)
63 $(INSTALL_PROG) $(ACM_SCRIPTS) $(DESTDIR)$(ACM_SCRIPT_DIR)
64 $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_HTMLDIR)
65 $(INSTALL_DATA) $(ACM_INST_HTML) $(DESTDIR)$(ACM_SECGEN_HTMLDIR)
66 $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
67 $(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
68 ifndef XEN_PYTHON_NATIVE_INSTALL
69 python python/setup.py install --install-lib="$(DESTDIR)$(LIBPATH)/python"
70 else
71 python python/setup.py install --root="$(DESTDIR)"
72 endif
73 else
74 .PHONY: all
75 all:
77 .PHONY: install
78 install:
79 endif
81 .PHONY: build
82 build: $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
83 python python/setup.py build
84 chmod 700 $(ACM_SCRIPTS)
86 xensec_tool: $(OBJS_TOOL)
87 $(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ -L$(XEN_LIBXC) -lxenctrl
89 xensec_xml2bin: $(OBJS_XML2BIN)
90 $(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^
92 xensec_gen: xensec_gen.py
93 cp -f $^ $@
95 .PHONY: clean
96 clean:
97 $(RM) $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
98 $(RM) $(ACM_OBJS)
99 $(RM) $(PROG_DEPS)
100 $(RM) -r build
102 .PHONY: mrproper
103 mrproper: clean
105 -include $(PROG_DEPS)