1obj-y += avc.o
2obj-y += hooks.o
3obj-y += flask_op.o
4
5obj-y += ss/
6
7CFLAGS-y += -I./include
8
9AWK = awk
10
11CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
12          else if [ -x /bin/bash ]; then echo /bin/bash; \
13          else echo sh; fi ; fi)
14
15FLASK_H_DEPEND = policy/security_classes policy/initial_sids
16AV_H_DEPEND = policy/access_vectors
17
18FLASK_H_FILES = include/flask.h include/class_to_string.h include/initial_sid_to_string.h
19AV_H_FILES = include/av_perm_to_string.h include/av_permissions.h
20ALL_H_FILES = $(FLASK_H_FILES) $(AV_H_FILES)
21
22$(obj-y) ss/built_in.o: $(ALL_H_FILES)
23extra-y += $(ALL_H_FILES)
24
25mkflask := policy/mkflask.sh
26quiet_cmd_mkflask = MKFLASK $@
27cmd_mkflask = $(CONFIG_SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND)
28
29$(subst include/,%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE
30	$(call if_changed,mkflask)
31
32mkaccess := policy/mkaccess_vector.sh
33quiet_cmd_mkaccess = MKACCESS VECTOR $@
34cmd_mkaccess = $(CONFIG_SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND)
35
36$(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
37	$(call if_changed,mkaccess)
38
39obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
40flask-policy.o: policy.bin
41
42flask-policy.S: $(XEN_ROOT)/xen/tools/binfile
43	$(SHELL) $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy
44
45FLASK_BUILD_DIR := $(CURDIR)
46POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
47
48policy.bin: FORCE
49	$(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common -C $(XEN_ROOT)/tools/flask/policy FLASK_BUILD_DIR=$(FLASK_BUILD_DIR)
50	cmp -s $(POLICY_SRC) $@ || cp $(POLICY_SRC) $@
51
52.PHONY: clean
53clean::
54	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC) flask-policy.S
55