1XEN_ROOT = $(CURDIR)/../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4# Relative to $(XEN_ROOT)/xen/xsm/flask
5FLASK_H_DEPEND := policy/initial_sids
6
7.PHONY: all build
8all build: xen-foreign xen/.dir xen-xsm/.dir
9
10.PHONY: xen-foreign
11xen-foreign:
12	$(MAKE) -C xen-foreign
13
14xen/.dir:
15	@rm -rf xen
16	mkdir -p xen/libelf
17	ln -sf $(XEN_ROOT)/xen/include/public/COPYING xen
18	ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) xen
19	ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 arch-arm hvm io xsm) xen
20	ln -sf ../xen-sys/$(XEN_OS) xen/sys
21	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
22	ln -s ../xen-foreign xen/foreign
23	ln -sf $(XEN_ROOT)/xen/include/acpi acpi
24	touch $@
25
26# Not xen/xsm as that clashes with link to
27# $(XEN_ROOT)/xen/include/public/xsm above.
28xen-xsm/.dir: $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
29	      $(patsubst %,$(XEN_ROOT)/xen/xsm/flask/%,$(FLASK_H_DEPEND))
30	mkdir -p xen-xsm/flask
31	cd $(XEN_ROOT)/xen/xsm/flask/ && \
32		$(SHELL) policy/mkflask.sh $(AWK) $(CURDIR)/xen-xsm/flask $(FLASK_H_DEPEND)
33	touch $@
34
35.PHONY: install
36install: all
37	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/arch-x86
38	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/arch-x86/hvm
39	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/arch-arm
40	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/arch-arm/hvm
41	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/foreign
42	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/hvm
43	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/io
44	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/sys
45	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xen/xsm
46	$(INSTALL_DATA) xen/COPYING $(DESTDIR)$(includedir)/xen
47	$(INSTALL_DATA) xen/*.h $(DESTDIR)$(includedir)/xen
48	$(INSTALL_DATA) xen/arch-x86/*.h $(DESTDIR)$(includedir)/xen/arch-x86
49	$(INSTALL_DATA) xen/arch-x86/hvm/*.h $(DESTDIR)$(includedir)/xen/arch-x86/hvm
50
51# 	xen/arch-arm doesn't contains headers for now. Uncommented the line
52# 	as soon as a new header is added
53#	$(INSTALL_DATA) xen/arch-arm/*.h $(DESTDIR)$(includedir)/xen/arch-arm
54	$(INSTALL_DATA) xen/arch-arm/hvm/*.h $(DESTDIR)$(includedir)/xen/arch-arm/hvm
55	$(INSTALL_DATA) xen/foreign/*.h $(DESTDIR)$(includedir)/xen/foreign
56	$(INSTALL_DATA) xen/hvm/*.h $(DESTDIR)$(includedir)/xen/hvm
57	$(INSTALL_DATA) xen/io/*.h $(DESTDIR)$(includedir)/xen/io
58	$(INSTALL_DATA) xen/sys/*.h $(DESTDIR)$(includedir)/xen/sys
59	$(INSTALL_DATA) xen/xsm/*.h $(DESTDIR)$(includedir)/xen/xsm
60
61.PHONY: uninstall
62uninstall:
63	echo "[FIXME] uninstall headers"
64	rm -rf $(DESTDIR)$(includedir)/xen
65
66.PHONY: clean
67clean:
68	rm -rf xen xen-xsm acpi
69	$(MAKE) -C xen-foreign clean
70
71.PHONY: dist
72dist: install
73
74.PHONY: distclean
75distclean: clean
76